Skip to content

Slider

Free

Pick a value or a range: drag a thumb along a thin track, or use the arrow keys. It has a label, a value, and one thumb for each value.

  • Base UI
  • React 19
  • Tailwind CSS 4

Added Nov 8, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

One line renders the root, the control, the track, the indicator, and one thumb per value. The children go above the control.

volume-slider.tsx

Slider

<div>
PropTypeDefaultDescription
classNamestring—
controlReactNode—The control under the children. Default: a SliderControl with the track, the indicator, and one thumb per value. Pass your own SliderControl to change a part (a thumb with a Tooltip).
thumbPropsOmit<SliderThumbProps, "index">—Props for every default thumb: getAriaLabel, getAriaValueText, aria-label, disabled.
tone"destructive""info""neutral""success""warning""neutral"default: the primary fill. A status colors the fill and the thumb edge: success a good value, warning a value that needs care, info a neutral mark, destructive a value over a limit. Color is never the only signal: say it in words too.
glowboolean—A soft halo in the fill color (glow, @gelatin-ui/glow). Default: false.
variant"bare""default""playhead""default"default: the track, the fill, and round thumbs. playhead: an invisible track over the parent's whole box and a 2px line thumb, for a scrub over a waveform or a timeline (the parent draws the played part). bare: the same press area with thumbs that the item draws (children of SliderThumb), for the handles of a timeline. Default default.
From Base UISlider.RootBase UI docs
defaultValueValue—The uncontrolled value of the slider when it's initially rendered. To render a controlled slider, use the value prop instead.
disabledbooleanfalseWhether the slider should ignore user interaction.
formatNumberFormatOptions—Options to format the value.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

SliderLabel

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

SliderValue

<output>
PropTypeDefaultDescription
classNamestring—
From Base UISlider.ValueBase UI docs
children—
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<output> attributes—Every other attribute goes to the <output>, with a ref.

SliderControl

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

SliderTrack

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

SliderIndicator

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

SliderThumb

<div>
PropTypeDefaultDescription
classNamestring—
From Base UISlider.ThumbBase UI docs
disabledbooleanfalseWhether the thumb should ignore user interaction.
aria-valuetextstring—A string value forwarded to the aria-valuetext attribute of the input. Ignored when getAriaValueText is provided.
getAriaLabel((index: number) => string) | null—A function which returns a string value for the aria-label attribute of the input.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • Use it when people pick a value by feel from a range.
  • Pass an array as value or defaultValue for a range with two or more thumbs.
  • Use tone for a value that has a meaning, and say the same in words.
  • Use variant="playhead" or bare over a waveform or a timeline. The parent draws the picture.
  • To type an exact number, use an Input.
  • To show a measured value that people do not set, use a Meter.
  • To change one channel of a color, use a Color Slider.
  • To pick a value on a moving scale, use a Ruler Slider.
  • For a track that stretches, marks that hold the thumb, and end icons, use an Elastic Slider.
Arrow keysChanges the value by one step. Left and Right follow the direction of the page.
Shiftarrow keysorPage UporPage DownChanges the value by largeStep.
HomeorEndGoes to the minimum or the maximum.
TabMoves to the next thumb.

It is a Base UI Slider. Each thumb is a native range input, and the arrow keys step the value.

Name the thumbs with a SliderLabel or thumbProps. Use getAriaValueText to read a range as one phrase.

On touch the control is 44px high, and the text stays 14px.

On touch, a swipe across the track scrolls the page and keeps the value. A swipe along it drags, and a tap sets it.

Thumb
none · the fill and the thumb follow the pointer with no transition
  1. AddedSlider.
Open the release