Search documentation

Search the documentation and open a page.

An input where the user selects a value from within a given range.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/slider

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

PropTypeDefaultDescription
idstring | undefined—Unique identifier used to connect the component parts.
idsElementIds | undefined—Overrides generated identifiers for individual parts.
namestring | undefined—Name used when submitting the value with a form.
formstring | undefined—Associates the control with a form by ID.
valuenumber[] | undefined—Current value when the component is controlled.
defaultValuenumber[] | undefined—Initial value when the component is uncontrolled.
disabledboolean | undefinedfalseDisables interaction with the component.
readOnlyboolean | undefinedfalsePrevents changes while preserving focus and navigation.
invalidboolean | 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.
minnumber | undefined—Configures min.
maxnumber | undefined—Configures max.
stepnumber | undefined—Configures step.
largeStepnumber | undefined—Configures large step.
minStepsBetweenThumbsnumber | 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

ExportAPI
SliderContextRender-prop component that exposes component state and actions.
SliderRootProviderProvides an externally created API to the component tree.
useSliderCreates or accesses the component API.
useSliderContextReturns the nearest component API.
SliderValueChangeDetailsType for the details object passed to the matching change callback.