Basic Usage
Displaying the Value
Every form control has an.rx property — a reactive reference to its current value. For a slider, .rx is a number you can format with pipes like .percent() or use in expressions:
When the display needs to appear above the slider in the layout, forward-declare the reference with Rx(lambda: ...) so it resolves at render time:
See Forward References for more on this pattern.
Range and Step
Usemin, max, and step to constrain the slider. Here the range is 0–5 with half-step increments:
With Actions
Theon_change parameter runs actions when the slider value changes. $event is the current numeric value:
Disabled State
Variants
Semantic variants color the filled track to communicate meaning at a glance — the same palette available on Progress:Sizes
Control the track thickness withsize. The default is a medium weight; use sm for compact layouts and lg for prominent controls:
Custom Colors
Useindicator_class for arbitrary track colors beyond the built-in variants:
Vertical Orientation
Setorientation="vertical" for vertical sliders. They fill their container’s height, so wrap them in a fixed-height parent:
Handle Styles
Thehandle_style parameter changes the thumb shape. Use "bar" for a tall rounded rectangle instead of the default circle:
API Reference
Slider Parameters
Initial value of the slider.
State key for the slider’s current value. Set this to bind the slider to state for display or form submission.
Minimum value of the range.
Maximum value of the range.
Step increment. If not provided, the slider moves continuously.
Whether the slider is non-interactive.
Visual variant for the filled track:
"default", "success", "warning", "destructive", "info", "muted".Track thickness:
"sm" (4px), "default" (6px), "lg" (10px).Tailwind classes for the filled track. Overrides variant coloring.
Layout direction:
"horizontal" or "vertical". Vertical sliders fill their container’s height.Thumb shape:
"circle" (default round) or "bar" (tall rounded rectangle).Action(s) to execute when the value changes.
$event is the current numeric value.Additional Tailwind CSS classes appended to the component’s built-in styles.
Protocol Reference
Slider