Slider

Range input with optional label and live value display.

With label and value

40
import { useState } from 'react'
import { Slider } from '@canarist/ui'

function Example() {
  const [value, setValue] = useState(40)
  return (
    <Slider
      label="Threshold"
      value={value}
      onChange={setValue}
      showValue
      min={0}
      max={100}
    />
  )
}

Reference

PropTypeDefaultDescription
valuenumberCurrent value (controlled).
onChange(value: number) => voidCalled with the new numeric value on every change.
labelstringLabel shown above the slider.
minnumber0Minimum value.
maxnumber100Maximum value.
stepnumber1Increment step.
showValuebooleanShow the current value to the right of the label.
errorstringError message shown below the slider.