Prepared Docs

Prepared Docs

⌘K

    Loading navigation…

User

  1. Components
  2. Slider
  3. API and Development

Slider

API and Development

View Source
Submit Issue

Slider displays an interactive control for selecting a single value or a range of values from a continuous or discrete set. Sliders provide visual feedback and allow precise value selection through dragging or keyboard navigation. It provides both single-value and range selection interfaces built on Radix UI's Slider component, ensuring consistent slider patterns across the interface with full keyboard and screen reader accessibility. Sliders support optional input fields for direct value entry, custom min/max/step values, and both controlled and uncontrolled states.

Props

Slider Props

NameDefaultDescription
valueCurrently selected value (controlled component).
defaultValueDefault selected value (uncontrolled component).
onChangeCallback function called when the value changes: (value: number) => void.
min0Minimum value for the slider.
max100Maximum value for the slider.
step1Step amount for value increments.
showInputfalseWhether to show an input field alongside the slider.
inputPlaceholderPlaceholder text for the input field.
inputWidth"8rem"Custom width for the input field.
disabledfalseWhether the slider is disabled.
nameThe name attribute for form submission.
idUnique identifier for the slider element.
aria-labelAccessible label for the slider.
aria-labelledbyID of the element that labels the slider.
aria-describedbyID of the element that describes the slider.

RangeSlider Props

NameDefaultDescription
valueCurrently selected range as a tuple [number, number] (controlled component).
defaultValueDefault selected range as a tuple [number, number] (uncontrolled component).
endValuerequiredInitial end value for the range slider.
startValueInitial start value for the range slider.
onChangeCallback function called when the range changes: (values: [number, number]) => void.
min0Minimum value for the slider.
max100Maximum value for the slider.
step1Step amount for value increments.
showInputfalseWhether to show input fields alongside the slider.
startInputPlaceholder"Min"Placeholder text for the start value input field.
endInputPlaceholder"Max"Placeholder text for the end value input field.
inputWidth"8rem"Custom width for the input fields.
disabledfalseWhether the slider is disabled.
nameThe name attribute for form submission.
idUnique identifier for the slider element.
aria-labelAccessible label for the slider.
aria-labelledbyID of the element that labels the slider.
aria-describedbyID of the element that describes the slider.

Basic Slider

Use for simple single-value selection.

Controlled Slider

Control slider value programmatically.

Slider with Input

Display an input field for direct value entry.

Custom Range

Set custom min, max, and step values.

Slider with Label

Provide context with a label.

Disabled Slider

Disable sliders when options are unavailable.

Range Slider

Select a range of values with start and end points.

Range Slider with Inputs

Display input fields for both start and end values.

Controlled Range Slider

Control range values programmatically.

Price Range Example

Use range sliders for filtering by price or other ranges.

Volume Control Example

Use sliders for volume or similar controls.

Form Integration

Use sliders within forms with proper naming.

Previous

Slider / Usage

Next

Slider / Accessibility

On this page

Props
Slider Props
RangeSlider Props
Basic Slider
Controlled Slider
Slider with Input
Custom Range
Slider with Label
Disabled Slider
Range Slider
Range Slider with Inputs
Controlled Range Slider
Price Range Example
Volume Control Example
Form Integration