Slider

Slider is an input for choosing a value, or a range, by dragging along a track.

Installation

Nothing to add. This component ships as source in your download, so it is already in your project.

Filesrc/vui/slider.tsx
Import from@viliha/vui-react/slider

The exported names are at the top of that file. The import path is an alias the download's tsconfig.json points at src/vui/, so you can move that folder and change one line rather than every file that imports from it.

Usage

Pass an array to defaultValue/value; multiple values render multiple thumbs (a range).

slider-demo.tsx
import { Slider } from "@viliha/vui-react/slider";

export function Example() {
  return <Slider defaultValue={[50]} max={100} step={1} />;
}

Slider props

Plus everything React.ComponentProps<typeof SliderPrimitive.Root> accepts, passed straight through to the underlying element.

PropTypeDefaultWhat it does
thumbLabels?readonly string[]—What each handle is called.