Slider
Documentation and examples for the Slider component.
When To Use
To input a value in a range.
Example Usage
astro
<Slider id="slider1" min={0} max={100} value={50} /> Range & Tooltips
Enable range to allow selecting a minimum and maximum value,
and pass an array to value. Adding tooltip will
display the current values when interacting.
astro
<Slider range tooltip value={[20, 80]} label="Price Range" /> Variants & Slots
The Slider supports a tall variant for a thicker track. You
can also customize the handler visual using the thumb slot.
astro
<Slider variant="tall" value={40} label="Brightness">
<div slot="thumb" class="w-8 h-8 bg-white border-2 border-zinc-900 rounded-md flex items-center justify-center shadow-sm">
<Icon name="Sun" class="w-4 h-4 text-zinc-900" />
</div>
</Slider> How to Use
astro
---
import Slider from '@/components/data-entry/Slider.astro';
---
<Slider id="slider1" min={0} max={100} value={50} /> API
| Property | Description | Type | Default |
|---|---|---|---|
| label | Label for the slider | string | |
| variant | Visual style variant | 'default' | 'tall' | 'default' |
| range | Enables dual-thumb range selection | boolean | false |
| value | Current value or array of two values for range | number | [number, number] | 50 |
| min | Minimum value | number | 0 |
| max | Maximum value | number | 100 |
| step | Granularity of the slider | number | 1 |
| tooltip | Shows the value in a tooltip | boolean | false |
| error | Indicates an error state or displays an error message | string | boolean | |
| success | Indicates a success state or displays a success message | string | boolean | |
| disabled | Disables the component | boolean | false |