Skip to main content
A slider component for selecting a value or range from a continuous spectrum.

Import

Anatomy

The Slider component consists of multiple parts:
  • Slider.Root - The container that manages slider state
  • Slider.Control - The track area that contains the slider
  • Slider.Track - Visual track showing the selected range
  • Slider.Thumb - Draggable handle for selecting values
  • Slider.Indicator - Visual indicator at specific positions
  • Slider.Value - Displays the current value

Basic Usage

Key Features

  • Single and range sliders
  • Controlled and uncontrolled modes
  • Min/max constraints
  • Step increments
  • Keyboard navigation
  • Horizontal and vertical orientation
  • Number formatting support
  • Accessible with proper ARIA attributes
  • Custom thumb alignment

Key Props

value

Type: number | readonly number[] The value of the slider. For range sliders, provide an array with two values. Use with onValueChange for controlled mode.

defaultValue

Type: number | readonly number[] The uncontrolled value when initially rendered.

min

Type: number Default: 0 The minimum allowed value of the slider.

max

Type: number Default: 100 The maximum allowed value of the slider.

step

Type: number Default: 1 The granularity with which the slider can step through values.

largeStep

Type: number Default: 10 The step value when using Page Up/Page Down or Shift + Arrow keys.

orientation

Type: 'horizontal' | 'vertical' Default: 'horizontal' The component orientation.

disabled

Type: boolean Default: false Whether the slider should ignore user interaction.

minStepsBetweenValues

Type: number Default: 0 The minimum steps between values in a range slider.

thumbAlignment

Type: 'center' | 'edge' | 'edge-client-only' Default: 'center' How the thumbs are aligned relative to the control when at min or max.

thumbCollisionBehavior

Type: 'push' | 'swap' | 'none' Default: 'push' Controls how thumbs behave when they collide during pointer interactions.

onValueChange

Type: (value: number | number[], eventDetails: ChangeEventDetails) => void Callback fired when the slider’s value changes.

onValueCommitted

Type: (value: number | number[], eventDetails: CommitEventDetails) => void Callback fired when the pointerup is triggered.

format

Type: Intl.NumberFormatOptions Options to format the input value.

Styling

Common Patterns

Range Slider

With Value Display

Vertical Slider

Price Range Selector

With Marks

Temperature Control