Skip to content
FormsInteractive playground

Slider

Precisely adjust a value or interval.

Preparing the playground…
Text and Markdown example
Slider · Example
1<Slider aria-label="Volume" defaultValue={[65]} min={0} max={100} step={5} showValue style={{width:280}} />
Read documentation in Markdown

How to use it

value and defaultValue are arrays. Use min, max and step to define the allowed range; add an accessible label.

Import

React / Next.js
1import { Slider } from "@kivora/nextjs";

Interactive examples run inside a component with "use client". The playground's Copy button includes the imports needed for the current example.

API reference 0.2.0

Types from the installed published version, including component properties and common HTML attributes. “Optional” does not imply a default value; omitting a property lets the component decide.

PropertyTypeDescription
aria-labelstringAccessible name of the control.
asChildbooleanApply props and behavior to a single compatible child element.
childrenReactNodeContent or child elements of the component.
classNamestringAdditional CSS classes to customize the element.
defaultCheckedbooleanInitial selection of the control.
defaultValuenumber[]Initial value when the component manages its own state.
dir"ltr" | "rtl"Interface reading direction.
disabledbooleanDisable interaction with the control.
formstringConfigures form. The type describes the supported values and structure.
formatValue((value: number, index: number, values: number[]) => ReactNode)Format the value for display.
idstringElement identifier; associates labels and descriptions.
invertedbooleanConfigures inverted. The type describes the supported values and structure.
maxnumberMaximum allowed value.
minnumberMinimum allowed value.
minStepsBetweenThumbsnumberConfigures minStepsBetweenThumbs. The type describes the supported values and structure.
namestringName used to identify the control in forms.
onChangeChangeEventHandler<HTMLDivElement, Element>Change event. Check the type: some controls return an object, others a DOM event.
onClickMouseEventHandler<HTMLDivElement>Action performed when the element is activated.
onSubmitSubmitEventHandler<HTMLDivElement>Form submission event.
onValueChange((value: number[]) => void)Receives the value after an interaction.
onValueCommit((value: number[]) => void)Callback for this event. The signature describes its arguments.
orientation"horizontal" | "vertical"Horizontal or vertical axis.
rangeClassNamestringCSS classes for the specified element.
roleAriaRoleSemantic role of the element. Keep the default role unless a change is justified.
showValuebooleanShow the value label.
stepnumberIncrement between values.
styleCSSPropertiesReact inline styles.
tabIndexnumberKeyboard focus order and availability.
thumbClassNamestringCSS classes for the specified element.
titlestringTitle or supplementary information.
trackClassNamestringCSS classes for the specified element.
valuenumber[]Controlled value. Update it from the change callback.
valueLabelClassNamestringCSS classes for the specified element.

TypeScript definition

Review each component's properties and published declaration. Native and accessibility attributes are inherited from the element specified by its type.

Slider33 properties
Slider · TypeScript
1Slider: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<HTMLSpanElement>>
API generated from @kivora/nextjs 0.2.0View package