CraftUI

Slider

A slider with a green fill and a square block thumb.

Music
70
Render distance
12
Locked by the host
40

Installation

npx shadcn@latest add @runqora/craft-slider

Usage

import { Slider } from "@/components/craft/slider";

<Slider defaultValue={70} label="Music" showValue />;

Examples

Controlled

Volume
50

Props

Prop

Type

Accessibility

  • The arrow keys move by step, Page Up and Page Down by largeStep, and Home and End jump to the ends.
  • label names the slider. Without one, pass aria-label.
  • Use format so that screen readers and showValue read the value properly, such as a percentage.

Customization

The fill uses the primary tokens, and the thumb uses the secondary tokens.

<Slider
  className="[--craft-primary-hi:#ff9999] [--craft-primary-lo:#cf4a4a] [--craft-primary:#ca3636]"
  label="Danger level"
/>

Dependencies

Source

On this page