Slider

An input where the user selects a value from within a given range.

Basic Usage

Slider wraps Material3's Slider with a custom thumb (20 dp circle with a primary border) and an 8 dp rounded track. It fills its parent width by default.

API Reference

Slider

ParameterTypeDefaultDescription
valueFloatThe current value of the slider.
onValueChange(Float) -> UnitCallback invoked continuously as the user drags the thumb.
modifierModifierModifierModifier applied to the slider. The component applies fillMaxWidth() and height(20.dp) internally.
valueRangeClosedFloatingPointRange<Float>0f..1fThe range of selectable values.
stepsInt0Number of discrete stops between start and end. 0 means continuous. Must be ≥ 0.
enabledBooleantrueWhen false, interaction is disabled and the component renders at reduced opacity.
colorsSliderColors?nullCustom Material3 SliderColors. When null, KomoUI theme tokens are applied automatically.

Behaviour notes

  • The thumb is a 20 dp circle with a 2 dp primary-colored border and a background-colored fill.
  • The track is 8 dp tall with fully rounded corners; the active (left) portion uses primary and the inactive (right) portion uses secondary.
  • When enabled = false, both active and inactive track colors are rendered at 50% alpha; the thumb uses mutedForeground at 50% alpha.
  • steps = 0 produces a continuous slider; steps = N adds N tick marks between the endpoints and snaps to N + 2 positions total (start + N steps + end).
Edit this page on GitHub