Slider
Slider lets someone choose a number by dragging a handle along a track.
Use a Slider for a value such as a volume, a price or a timeout, where the rough position in the range matters more than the exact number. When people need to type an exact number, use a NumberField instead.
Pressing anywhere on the Slider moves the nearest handle there, and the pressable area is as tall as a Button of the same size. The handle is the same size as a Checkbox at that size, so the two look like they belong together in a form. A Slider fills the width of its container, so set the width on the container rather than on the Slider.
To choose a range, pass an array as the value and the Slider draws one handle for each entry. The filled part of the track uses the accent colour and the rest of the track is neutral. A disabled Slider turns the filled part grey.
Each handle is a real range input, so the arrow keys, Page Up, Page Down, Home and End all move it. Name a Slider that stands alone with aria-label. Inside a Field, the FieldLabel names it for you. In a right-to-left page the Slider fills from the right, and the arrow keys follow that direction.
Props
Generated from the types. It lists what this component DECLARES: a prop that arrives from a shared type or from the platform is real and is not repeated here.
| Prop | Type | What it does |
|---|---|---|
aria-label? | string | The accessible name of the slider. |
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
size? | "1" | "2" | "3" | "4" | The size step of the slider, from 1 to 4. |
toneandemphasis— A slider sets a value rather than running an action, so there is nothing for a colour or a louder style to rank. Every slider in a form looks the same.orientation— A vertical slider needs its own set of measurements, which have not been designed yet. For now, every Slider is horizontal.