Slider
Terminal-style horizontal slider with ASCII track display.
Import
Basic Usage
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | — | Current value (controlled) |
defaultValue | number | 0 | Default value (uncontrolled) |
onValueChange | (value: number) => void | — | Callback when value changes |
min | number | 0 | Minimum value |
max | number | 100 | Maximum value |
step | number | 1 | Step increment |
label | string | — | Label text |
showValue | boolean | false | Whether to show current value |
disabled | boolean | false | Whether the slider is disabled |
className | string | — | Additional CSS class names |
ref | React.Ref<HTMLDivElement> | — | Forwarded ref to the container |
With Label
Volume
Show Value
Brightness
Custom Range
Temperature
Step Values
States
Controlled Slider
Progress
Value: 50
Volume Control Example
Interactive RGB Example
Visual Design
The slider uses ASCII characters to create a terminal-style track:
- Track:
-(box drawing horizontal) - Handle:
*(bullet) - Display:
[-----*------]
Keyboard Navigation
| Key | Action |
|---|---|
Arrow Left / Arrow Down | Decrease by step |
Arrow Right / Arrow Up | Increase by step |
Home | Go to minimum |
End | Go to maximum |
Page Up | Increase by large step |
Page Down | Decrease by large step |
Accessibility
- Built on Base UI's accessible slider primitive
- Proper ARIA attributes for screen readers
- Full keyboard navigation support
- Focus visible states
Styling
| Variable | Description |
|---|---|
--theme-text | Track and handle color |
--theme-border | Container border |
--theme-focused-border | Focus outline color |