Slider
Draggable range input for selecting a numeric value.
Selectors
.slider- Range input styled as macOS-style slider with thumb and track.
Default
<input type="range" min="0" max="100" value="33" class="slider w-full max-w-sm" aria-label="Value" />
With Label
<label class="max-w-sm space-y-3">
<div class="flex items-center justify-between">
<span>Temperature</span>
<span class="text-sm text-tertiary-foreground">70</span>
</div>
<input type="range" min="0" max="100" value="70" step="1" class="slider w-full" />
</label>
With Ticks
<label class="max-w-sm space-y-3">
<div class="flex items-center justify-between">
<span>Volume</span>
<span class="text-sm text-tertiary-foreground">50%</span>
</div>
<input type="range" min="0" max="100" value="50" step="25" class="slider w-full" />
<div class="flex justify-between text-xs text-tertiary-foreground">
<span>0</span>
<span>25</span>
<span>50</span>
<span>75</span>
<span>100</span>
</div>
</label>
Disabled
<input type="range" min="0" max="100" value="50" class="slider w-full max-w-sm" disabled aria-label="Disabled slider" />
Usage
Include the slider JS to enable the track fill effect. Without it, the filled portion of the track won't update as the slider moves.
Accessibility
Always pair a slider with a <label> or use aria-label so screen readers can identify its purpose. Native <input type="range"> exposes value, min, and max to assistive technology automatically.
Keyboard: use arrow keys to adjust value by step, Home/End to jump to min/max.