uimaxxer

Slider

Grab anywhere on the track and it follows your finger 1:1. Pull past an end and the track squashes like rubber; let go and it springs to the nearest step.

npx shadcn@latest add https://uimaxxer.com/r/slider.json
PasskeysSettings · Limits

Limits

Spend cap per run

$0$50

4 agents at the cap spend at most $0.00 a run.

Usage

import { Slider } from "@/components/ui/slider"

<Slider label="Spend cap per run" defaultValue={[12.5]} max={50} step={2.5} format={(v) => `$${v.toFixed(2)}`} />
<Slider label="Agents may merge" defaultValue={[9, 17.5]} min={6} max={22} step={0.5} />

Props

PropTypeDefaultWhat it does
valuenumber[]Controlled. One value, or two for a range.
defaultValuenumber[][min]Initial value when uncontrolled.
onValueChange(value: number[]) => voidCalled each time the value steps.
onValueCommit(value: number[]) => voidCalled when a drag or key press ends.
min / max / stepnumber0 / 100 / 1The scale. Decimal steps are kept exact.
minStepsBetweenThumbsnumber0Range only: how close the thumbs may get.
ticksbooleanfalseMarks each step on the track, up to 40.
labelReactNodeShown above the track with the live readout.
format(value: number) => stringStringFormats the readout and aria-valuetext.
thumbLabelsstring[]Names for each thumb, read by screen readers.
size"md" | "lg""md"lg is a 16px track with a 40px thumb, for a feature moment.
disabledbooleanDims and ignores input.

Keyboard

← →
One step
Shift + ← →
Ten steps
Page Up / Down
Ten steps
Home / End
Minimum / maximum

Accessibility

  • Each thumb is role=slider with aria-valuenow, aria-valuetext and its own bounds.
  • Range thumbs cannot cross; their min and max follow each other.
  • Pressing the track focuses the thumb it moves, so the keyboard carries on from there.