Slider

@/components/kamod-ui/slider

Basic

Installation

Import Slider from `@/components/kamod-ui/slider`. The live preview below matches the kitchen sink default (single thumb, shadcn-style array defaultValue).

pnpm add @kamod-ch/ui

Default

Usage

Pass `defaultValue` or `value` as a number or array (one thumb per entry). Use `onValueChange` for controlled updates.

import { Slider } from "@/components/kamod-ui/slider";
<Slider />

Basic (shadcn-style array)

Single thumb using array syntax, matching the Radix/shadcn API.

Range

Two values produce a range slider with a filled track between the thumbs.

Range

Multiple thumbs

Use three or more values for multiple thumbs along the same track.

Multiple thumbs

Stepped

Use step values for discrete increments.

Stepped

Controlled (single)

Store the value in state; `onValueChange` receives a number array (length 1 for a single thumb).

Temperature33

Controlled (range)

Controlled range on a fractional scale, similar to the shadcn docs demo.

Temperature0.30, 0.70

Disabled

Disable interaction for single or range sliders.

Disabled

Disabled range

API Reference

Props, slots and variants for this component.

Slider

Slider component props and accepted values.

PropTypeDefault
defaultValuenumber | number[]50 (single)
valuenumber | number[]undefined
onValueChange(value: number[]) => voidundefined
onValueCommit(value: number[]) => voidundefined
orientation"horizontal" | "vertical""horizontal"
min / max / stepnumber0 / 100 / 1
disabledbooleanfalse
onInput(event) => voidundefined
classstringundefined

Accessibility Notes

Provide a visible label or `aria-label`. For multi-thumb sliders, each thumb exposes a short default label; override via props spread to the first thumb where needed.