A Slider allows the user to select values in a linear range of values.

installyarn add @clayui/slider
versionNPM Version
useimport Slider from '@clayui/slider';

Slider is a controlled component and needs just 2 props for its basic use, value and onChange.

Range and Step

For a more specific use case you can specify other props, like min and max to determine the range, and step to specify how much the value changes.

API Reference

Slider

({ className, defaultValue, disabled, max, min, onChange, onValueChange, showTooltip, step, tooltipPosition, value, ...otherProps }: IProps) => JSX.Element
Parameters
Properties

defaultValue

number | undefined

Property to set the default value (uncontrolled).

disabled

boolean | undefined

Flag that will disable component features.

max

number | undefined= 100

Sets maximum permitted value.

min

number | undefined

Sets minimum permitted value

onChange

InternalDispatch<number> | undefined

Callback will always be called when the slider value changes (controlled).

Deprecated

onValueChange

InternalDispatch<number> | undefined

Callback will always be called when the slider value changes.

showTooltip

boolean | undefined= true

Flag to show tooltip or not.

step

number | undefined= 1

Sets stepping interval.

tooltipPosition

"top" | "bottom" | undefined= "top"

Set tooltip position.

value

number | undefined

Set the current value of the slider (controlled).

Returns
Element
Edit this page on GitHub

Contributors

Matuzalém Teles, Bryce Osterhaus, Krešimir Čoko

Last edited May 9, 2025 at 6:15:38 AM