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
valuenumber—Current value (controlled).
onChange(value: number) => void—Called with the new numeric value on every change.
labelstring—Label shown above the slider.
minnumber0Minimum value.
maxnumber100Maximum value.
stepnumber1Increment step.
showValueboolean—Show the current value to the right of the label.
errorstring—Error message shown below the slider.