Slider
Documentation and examples for the Slider component.
When To Use
Para ingresar un valor dentro de un rango.
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
| Propiedad | Descripción | Tipo | Por defecto |
|---|---|---|---|
| label | Etiqueta para el control deslizante | string | |
| variant | Variante de estilo visual | 'default' | 'tall' | 'default' |
| range | Habilita la selección de rango con dos controles | boolean | false |
| value | Valor actual o matriz de dos valores para el rango | number | [number, number] | 50 |
| min | Valor mínimo | number | 0 |
| max | Valor máximo | number | 100 |
| step | Granularidad del control deslizante | number | 1 |
| tooltip | Muestra el valor en una información sobre herramientas | 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 |