No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

Slider

⚠️ Preview components are considered unstable:

  • Features and APIs may change before final release
  • Please contact us if you intend to use this in your product

Default

Open in CodeSandbox
NameDescriptionDefault
input

The hidden input for the Slider. This is the PRIMARY slot: all native properties specified directly on <Slider> will be applied to this slot, except className and style, which remain on the root slot.

ShorthandProps<{ as?: "input"; } & Pick<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof InputHTMLAttributes<...>> & { ...; } & { ...; } & { ...; }>
-
root

The root of the Slider. The root slot receives the className and style specified directly on the <Slider>. All other native props will be applied to the primary slot, input.

ShorthandProps<{ as?: "div"; } & Pick<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof HTMLAttributes<...>> & { ...; } & { ...; }>
-
as
"input"
-
rail
The Slider's base. It is used to visibly display the min and max selectable values.
ShorthandProps<{ as?: "div"; } & Pick<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof HTMLAttributes<...>> & { ...; } & { ...; }>
-
thumb

The draggable icon used to select a given value from the Slider. This is the element containing role = 'slider'.

ShorthandProps<{ as?: "div"; } & Pick<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof HTMLAttributes<...>> & { ...; } & { ...; }>
-
orient

Orient is a non standard attribute that allows for vertical orientation in Firefox. It is set internally when vertical is set to true. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range#non_standard_attributes Webkit/Chromium support for vertical inputs is provided via -webkit-appearance css property

"horizontal""vertical"
-
defaultValue

The starting value for an uncontrolled Slider. Mutually exclusive with value prop.

number
-
value

The current value of the controlled Slider. Mutually exclusive with defaultValue prop.

number
-
vertical
Whether to render the Slider vertically.
boolean
`false` (renders horizontally)
origin
The starting origin point for the Slider.
number
min
size
The size of the Slider.
"small""medium"
"'medium'"
onChange
Triggers a callback when the value has been changed. This will be called on every individual step.
((ev: ChangeEvent<HTMLInputElement>, data: SliderOnChangeData) => void)
-
getAriaValueText
The Slider's current value label to be read by the screen reader.
((value: number) => string)
-

Stories

Size

A slider comes in both medium and small size. Medium is the default.

Open in CodeSandbox

Controlled

A slider can be a controlled input where the slider value is stored in state and updated with onChange.

Open in CodeSandbox

Step

You can define the step value of a slider so that the value will always be a mutiple of that step

Open in CodeSandbox

Origin

A slider's progress can be represented with an origin so that values below the origin will have negative progress and those above will have positive progress. Origin, however, has no effect on the actual value of the slider.

Open in CodeSandbox

Vertical

A slider can be rendered vertically where the max value is at the top of the slider.

Open in CodeSandbox

Disabled

A disabled slider will not change or fire events on click or keyboard press.

Open in CodeSandbox