Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
Composition
Slider ├── SliderLabel (optional) ├── SliderControl │ ├── SliderTrack │ │ └── SliderRange │ └── SliderThumb │ └── SliderHiddenInput ├── SliderMarkerGroup (optional) │ └── SliderMarker └── SliderValueText (optional)
Examples
Autoscaling
Loading...
Color
Loading...
Default
Loading...
Disabled
Loading...
Inline
Loading...
Range
Loading...
Scrubber
Loading...
Vertical
Loading...
API Reference
Slider
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | undefined | — | Unique identifier used to connect the component parts. |
ids | ElementIds | undefined | — | Overrides generated identifiers for individual parts. |
name | string | undefined | — | Name used when submitting the value with a form. |
form | string | undefined | — | Associates the control with a form by ID. |
value | number[] | undefined | — | Current value when the component is controlled. |
defaultValue | number[] | undefined | — | Initial value when the component is uncontrolled. |
disabled | boolean | undefined | false | Disables interaction with the component. |
readOnly | boolean | undefined | false | Prevents changes while preserving focus and navigation. |
invalid | boolean | undefined | — | Marks the associated form control as invalid. |
onValueChange | ((details: ValueChangeDetails) => void) | undefined | — | Runs when value changes. |
onValueChangeEnd | ((details: ValueChangeDetails) => void) | undefined | — | Runs when value change end changes. |
onFocusChange | ((details: FocusChangeDetails) => void) | undefined | — | Runs when focus changes. |
getAriaValueText | ((details: ValueTextDetails) => string) | undefined | — | Configures get aria value text. |
min | number | undefined | — | Configures min. |
max | number | undefined | — | Configures max. |
step | number | undefined | — | Configures step. |
largeStep | number | undefined | — | Configures large step. |
minStepsBetweenThumbs | number | undefined | — | Configures min steps between thumbs. |
orientation | "vertical" | "horizontal" | undefined | "horizontal" | Sets the component orientation and keyboard navigation axis. |
origin | "start" | "center" | "end" | undefined | — | Configures origin. |
thumbAlignment | "contain" | "center" | undefined | — | Configures thumb alignment. |
thumbSize | { width: number | — | Configures thumb size. |
thumbCollisionBehavior | "none" | "push" | "swap" | undefined | — | Configures thumb collision behavior. |
Context, Hooks, and Types
| Export | API |
|---|---|
SliderContext | Render-prop component that exposes component state and actions. |
SliderRootProvider | Provides an externally created API to the component tree. |
useSlider | Creates or accesses the component API. |
useSliderContext | Returns the nearest component API. |
SliderValueChangeDetails | Type for the details object passed to the matching change callback. |
Angular
React
Solid
Svelte
Vue