Skip to content
Redpanda UI
Esc
↑↓navigate↵open⌘Jpreview
Made by shadcn
Edit on GitHub

Slider

An input where the user selects a value from within a given range.

Installation

bash
npx shadcn@latest add @redpanda/slider
bash
pnpm dlx shadcn@latest add @redpanda/slider
bash
yarn dlx shadcn@latest add @redpanda/slider
bash
bunx shadcn@latest add @redpanda/slider
bash
nubx shadcn@latest add @redpanda/slider
bash
aube dlx shadcn@latest add @redpanda/slider

Range

Vertical orientation

Disabled

Live value label

Custom step increments

Formatted value

Drag bubble

Custom min, max, and step

When to use

Sliders allow users to select a value from a range. Use this decision tree:

Usage

tsx
import { Slider } from '@/components/ui/slider';
tsx
<Slider defaultValue={[33]} max={100} step={1} />

Props

Keyboard interactions

Key Action
Tab to thumb Focus lands on the thumb. Range sliders have one thumb per value.
ArrowLeft / ArrowDown Decreases value by one step.
ArrowRight / ArrowUp Increases value by one step.
PageDown / PageUp Decreases / increases by a larger step (roughly 10% of the range).
Home / End Jumps to min / max.

Accessibility

  • Each thumb exposes role="slider" with aria-valuemin, aria-valuemax, and aria-valuenow. Always provide a programmatic label (<Label> + aria-labelledby, or aria-label) describing what the value represents.
  • Pair the slider with a visible numeric value where precision matters — sliders alone are hard to read for screen-reader and low-vision users.
  • onValueChange receives number[] (always an array, even for single-thumb sliders) — unwrap with value[0] when you only need a scalar.
  • Range sliders enforce minValue[i] <= value[i] <= value[i+1] <= maxValue automatically; you don’t need to clamp in user land.

Credits

  • We use Base UI for the slider component.
  • We take our inspiration from Shadcn UI for the slider style.

Recent changes

  • patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested baseline while caret semantics still allow any compatible release within the same major.#133
  • minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
  • minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
  • majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
  • minorv0.3.0Add theme-provider component to the registry with documentation and tests. Includes playground type improvements (export RegistryItem, remove as-const boilerplate) and docs site dark mode border color fix.#109
See full history →

Last updated on

Was this page helpful?