Slider
An input where the user selects a value from within a given range.
Installation
pnpm add @heyramzi/ui bits-uiUsage
import { Slider } from "@heyramzi/ui/shadcn/slider";<Slider type="single" bind:value max={100} step={1} thumbLabel="Volume" />Keyboard and accessibility
| Key | Does |
|---|---|
| Arrow Right Arrow Up | Raises the value by one step. |
| Arrow Left Arrow Down | Lowers the value by one step. |
| Home | Sets the minimum. |
| End | Sets the maximum. |
| Cmd Arrow Right Cmd Arrow Up | Jumps to the maximum. |
| Cmd Arrow Left Cmd Arrow Down | Jumps to the minimum. |
- The thumb is the slider a screen reader hears. Name it with thumbLabel.
- A range slider has one thumb per value, and each is its own Tab stop.
API reference
valueTextstring- Announced in place of the raw value, for a slider running on stop indices.
thumbLabelstring- Names the thumb, which is the element carrying `role="slider"`.
refbindableHTMLElement | null- Default
null valuebindableSlider.Rootclassstring...rest- Every prop of
Slider.Rootfrombits-uiexceptchild, children
| Prop | Type | Default |
|---|---|---|
valueText Announced in place of the raw value, for a slider running on stop indices. | string | |
thumbLabel Names the thumb, which is the element carrying `role="slider"`. | string | |
ref bindable | HTMLElement | null | null |
value bindable | Slider.Root | |
class | string | |
...rest | Every prop of Slider.Root from bits-ui except child, children | |