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}} />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.
| Property | Type | Description |
|---|---|---|
aria-label | string | Accessible name of the control. |
asChild | boolean | Apply props and behavior to a single compatible child element. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | number[] | Initial value when the component manages its own state. |
dir | "ltr" | "rtl" | Interface reading direction. |
disabled | boolean | Disable interaction with the control. |
form | string | Configures form. The type describes the supported values and structure. |
formatValue | ((value: number, index: number, values: number[]) => ReactNode) | Format the value for display. |
id | string | Element identifier; associates labels and descriptions. |
inverted | boolean | Configures inverted. The type describes the supported values and structure. |
max | number | Maximum allowed value. |
min | number | Minimum allowed value. |
minStepsBetweenThumbs | number | Configures minStepsBetweenThumbs. The type describes the supported values and structure. |
name | string | Name used to identify the control in forms. |
onChange | ChangeEventHandler<HTMLDivElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLDivElement> | Action performed when the element is activated. |
onSubmit | SubmitEventHandler<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. |
rangeClassName | string | CSS classes for the specified element. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
showValue | boolean | Show the value label. |
step | number | Increment between values. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
thumbClassName | string | CSS classes for the specified element. |
title | string | Title or supplementary information. |
trackClassName | string | CSS classes for the specified element. |
value | number[] | Controlled value. Update it from the change callback. |
valueLabelClassName | string | CSS 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