Skip to content

Sliders

Slider is a thin wrapper over the Radix Slider primitive. Reach for it when a number is best chosen by dragging within a known range (volume, opacity, a price band) rather than typed. Pass a single value for one thumb or two values for a range.

Live demo

The interactive story below runs from the deployed Storybook.

Usage

Source: slider.tsx

import { Slider } from "@beacon/design-system";
// Single value
<Slider defaultValue={[50]} max={100} step={1} className="w-[300px]" />
// Range: two thumbs
<Slider defaultValue={[25, 75]} max={100} step={1} className="w-[300px]" />
// Disabled
<Slider defaultValue={[40]} disabled className="w-[300px]" />

Props

Slider forwards every prop from the Radix Slider.Root. The most common ones:

PropTypeDefaultDescription
defaultValuenumber[]—Uncontrolled starting value. One entry per thumb (range = two entries).
valuenumber[]—Controlled value. Pair with onValueChange.
onValueChange(value: number[]) => void—Fires while dragging as the value changes.
minnumber0Lower bound of the range.
maxnumber100Upper bound of the range.
stepnumber1Granularity of each move.
disabledbooleanfalseGreys out and blocks interaction.
orientation"horizontal" | "vertical""horizontal"Track direction.
classNamestring—Extra classes on the root (set a width here).

When to use

  • Choosing a value within a bounded, continuous range where the relative position matters more than an exact figure.
  • Picking a min/max range (price filter, date band) with the two-thumb variant.
  • Settings such as volume, brightness, or opacity where dragging is more natural than typing.

Do not use a slider when the user needs to enter a precise number; use a numeric Input or Stepper instead. For a small set of discrete options reach for Segmented Controls instead.