RangeSlider
Dual-thumb numeric range slider with labeled native inputs and formatted values.
Design intent
Data dashboards need a low/high range for revenue, EBITDA or dates, but a single range input cannot express two thumbs accessibly. RangeSlider composes two native range inputs so keyboard and screen-reader behavior stay native while the track renders one selection.
npx @slipstream-ui/cli@latest add range-sliderAmount range
Showing results from $5M to $100M.
Budget allocation
Allocating 30% to 70% of the budget.
Locked range
Disabled while an approval is pending.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value | [number, number] | — | Controlled low/high pair. |
| defaultValue | [number, number] | — | Initial low/high pair when uncontrolled. Defaults to [min, max]. |
| onValueChange | (value: [number, number]) => void | — | Fires with the next low/high pair. |
| min | number | 0 | Lower bound. |
| max | number | 100 | Upper bound. |
| step | number | 1 | Increment. |
| startLabel | string | 'Minimum' | Accessible label for the low thumb. |
| endLabel | string | 'Maximum' | Accessible label for the high thumb. |
| formatValue | (value: number) => string | — | Formats the displayed values and aria-valuetext. |
| showValues | boolean | true | Show the current low/high values above the track. |
| disabled | boolean | — | Disable both thumbs. |
Anti-patterns
validate_usage is the MCP tool that rejects these mistakes: the same list agents see over MCP and in the canonical markdown.
Don't use a single range input for two values
A single thumb cannot express a minimum and maximum. Use RangeSlider when both ends are adjustable.
tsx// Avoid<input type="range" />// Prefer<RangeSlider defaultValue={[20, 80]} />Don't hide the labels
Each thumb needs a distinct accessible name so screen-reader users know which end they are changing.
tsx<RangeSlider startLabel="Revenue minimum" endLabel="Revenue maximum" />
Accessibility
- Uses two native range inputs, each with its own label and aria-valuetext.
- The low thumb cannot cross the high thumb, so the pair always stays ordered.
- Both thumbs are centred on the track in WebKit and Firefox, so the grab target matches the visual line.
Content guidelines
Range values
- Use the same unit on both ends
- Format compactly
- Prefer 5/50/100 style milestones when exact values are not meaningful
Good examples
- $5M to $100M
Bad examples
- 5 to 100000000
Composition
Compose with FilterPanel: Place RangeSlider inside a filter panel or FilterBar for live numeric filtering
<FilterBar><RangeSlider defaultValue={[5, 100]} /></FilterBar>
Related components: FilterChips, FilterBar, SegmentedControl
Dependencies
What the registry installs alongside this component. Package imports already include these.
npm packages
- class-variance-authority
- clsx
- tailwind-merge
Browser support
| Browser | Tested versions |
|---|---|
| Chrome | 111+ (Mar 2023) |
| Edge | 111+ (Mar 2023) |
| Firefox | 121+ (Dec 2023) |
| Safari | 17.2+: macOS & iOS (Dec 2023) |
Slipstream components rely only on CSS custom properties, Flexbox/Grid, and ARIA, the everyday baseline of the last two years of evergreen releases. Anything newer is progressive enhancement: unsupported browsers keep full functionality with static behavior instead of animations.
- The track is 4px tall and the thumb is 16px. WebKit positions the thumb from the track top, so the component applies a -6px offset to centre it; Firefox centres it natively.