Slider Preview
A slider lets someone set a value from a given range. Sliders can take immediate effect, like a volume control, or can require a submission, like in a form.
Use a slider for imprecise values. Don't use them for ranges that are very small or very large. For precise numerical inputs, like a dollar amount, try an input.
Properties
as
“input”
defaultValue
The starting value for an uncontrolled Slider. Mutually exclusive with
value
prop.
number
input
The hidden input for the Slider. This is the PRIMARY slot: all native properties specified directly on
will be applied to this slot, except
<Slider>
className
and
style
, which remain on the root slot.
({ as?: "input"; } & Omit<Pick<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof InputHTMLAttributes<...>> & { ...; }, "children"> & { ...; } & { ...; })
onChange
Triggers a callback when the value has been changed. This will be called on every individual step.
((ev: ChangeEvent<HTMLInputElement>, data: SliderOnChangeData) => void)
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”
rail
The Slider’s base. It is used to visibly display the min and max selectable values.
WithSlotShorthandValue<{ as?: "div"; } & Pick<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof HTMLAttributes<...>> & { ...; } & { ...; }>
root
The root of the Slider. The root slot receives the
className
and
style
specified directly on the
. All other native props will be applied to the primary slot,
<Slider>
input
.
WithSlotShorthandValue<{ as?: "div"; } & Pick<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof HTMLAttributes<...>> & { ...; } & { ...; }>
size
The size of the Slider.
“small”
“medium”
“‘medium’”
thumb
The draggable icon used to select a given value from the Slider. This is the element containing
role = ‘slider’
.
WithSlotShorthandValue<{ as?: "div"; } & Pick<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof HTMLAttributes<...>> & { ...; } & { ...; }>
value
The current value of the controlled Slider. Mutually exclusive with
defaultValue
prop.
number
vertical
Render the Slider in a vertical orientation, smallest value on the bottom.
boolean
`false`