Slider
Picks a value from a continuous range by dragging.
- Status
- ReadyBuild day 16 of 21
- Code
- In React
- Role
- Form
Usage
This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.
Pastes as editable layers. Shadows are not exported.
import { Slider } from "@/ui";
export default function SliderDemo() {
return <Slider label="Term" min={1} max={30} defaultValue={15} format={(n: number) => n + " yrs"} />;
}Variants and states
Every specimen is the real component from src/ui, held in one state.
Pastes as editable layers. Shadows are not exported.
Props
- label
- string · default none
- Required.
- mode
- "single" | "range" · default "single"
- Range has two thumbs.
- value, onChange
- number or [number, number] · default none
- Controlled value.
- defaultValue
- number or [number, number] · default none
- Uncontrolled start.
- min, max, step
- number · default 0, 100, 1
- format
- (value) => string · default none
- Text shown and read, such as 15 yrs.
- size
- "sm" | "md" | "lg" · default "md"
- Track 2, 4, 6; thumb 12, 16, 20.
- showLabel, showValue
- boolean · default true
- disabled
- boolean · default none
Figma to code
Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.
- 🔀 Mode
- mode
- single or range.
- 📐 Size
- size
- sm, md, or lg.
- 🎯 State
- disabled
- Hover and focus come from the browser.
- Show Label
- showLabel
- Boolean.
- Show Value, Value
- showValue, format
- The value text is computed.
Accessibility
What the code in src/ui does today, and what it leaves to you.
Keyboard
- Native range inputs: arrows step, Page Up and Page Down jump, Home and End go to the ends. Range has two inputs in Tab order.
Screen readers
- Each thumb is named by the label, with minimum or maximum in range mode, and reads the formatted value through aria-valuetext.
What you still need to do
- The row is 44px tall, so the whole width is the touch target.
When to use
Choices where position in the range matters more than the exact value, such as volume or a price filter.
Do and don't
Do
- Show the current value next to the slider.
- Support arrow keys for fine steps.
Don't
- Use for exact values like an amount to transfer: use an input.
- Make the thumb smaller than a finger.
Related
4 of 16 other atoms, same role and ready ones first.
- CheckboxLets users select one or more options from a set.Ready
- OTP InputBoxes for entering a one-time code sent by SMS or email.Ready
- PIN InputMasked boxes for entering a secret PIN.Ready
- Radio ButtonA single option that belongs to a set where only one can be chosen.Ready
Status reflects the component tracker snapshot of 29 October 2026.