Slider
Slider adjusts an approximate value within a bounded range. Use it when users can perceive the result immediately and relative position matters more than typing an exact number.
Usage
Import Tailwind and the complete A3S style bundle:
Use a native range input with a visible label. Include the Range runtime so the visual fill stays synchronized with the native value.
For component-level loading, import base styles, Range structure, the A3S visual style, the runtime, and Range controller. See Installation for CDN and other integrations.
Parameters
Product decisions
Choose Slider only when all of these are true:
- The range has meaningful minimum and maximum values.
- Users can see or otherwise perceive the result while adjusting it.
- Approximate selection or a small, predictable step is acceptable.
- The current value and unit can be communicated next to the control.
Use a numeric field instead when users must enter an exact value, compare several precise values, or work with an unbounded range. When both fast adjustment and exact entry matter, compose Slider with a synchronized numeric field and keep one shared value model.
States and variants
Standalone
A standalone slider still needs an accessible name. It is appropriate inside a surface that already exposes the current value visually, such as a media player.
Label and live value
Keep the label at the start and the live value at the end of the same row. Include units in visible output and aria-valuetext when the raw number is ambiguous.
Form field
When Slider belongs to a form, explain the consequence or limit and associate it with aria-describedby. The native value remains the submitted value; formatted output is presentation.
Maximum budget: .
Disabled
Disabled controls keep their value visible. Put the reason next to the field so the muted appearance is not the only explanation.
This limit is managed by the workspace policy.
RTL
Set dir="rtl" on the input or an ancestor. The filled track grows from the logical start edge, and native directional keys follow the document direction. The numeric meaning of minimum and maximum does not change.
Accessibility
- Give every slider an accessible name through a visible
labelwhenever possible. Usearia-labelonly when the surrounding interface already makes the purpose visible. - Declare truthful
min,max, andstepvalues. Do not rely on tick marks or spatial position to communicate a hidden scale. - Show the current value and unit near the track. Add localized
aria-valuetextwhen the raw number needs units, categories, or another human-readable meaning. - Preserve native keyboard behavior: arrows change one step, Page Up and Page Down make larger changes where supported, and Home and End reach the declared endpoints.
- Do not add easing or delayed animation to pointer dragging; the thumb and visible result must follow input directly.
- Keep the full hit target at least 44px on coarse pointers while the visible track and thumb remain compact.
- Disabled sliders retain a readable value and an adjacent reason. Do not hide a policy or permission constraint behind reduced opacity alone.
- In RTL, use logical direction for visual fill and layout. Test the actual keyboard behavior instead of mirroring only the artwork.
