Inline Slider

A slider with its label and value inside the track and a thumb that parts.

Preview

"use client";

import { InlineSlider } from "@/components/motion/range-slider-inline";

export function InlineSliderPreview() {
  return (
    <div className="w-full max-w-sm">
      <InlineSlider
        sound
        defaultValue={48}
        min={8}
        max={128}
        step={8}
        label="Icon size"
        aria-label="Icon size"
        formatValueText={(value) => `${value} pixels`}
      />
    </div>
  );
}

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/range-slider-inline

API Reference

step?
number

Rounds snap-stop values. While dragging, the readout keeps this step's decimal precision.

Default—
label
string

Compact label inside the left edge of the track.

Default—
format?
((value: number) => string)

Formats the inline value without changing its precision.

Default—
showTicks?
boolean

Show markers for the ten evenly spaced snap stops, except where they overlap inline text.

Defaulttrue
className?
string

Classes merged onto the track element.

Default—
value?
number

The current value, for controlled use.

Default—
defaultValue?
number

The initial value when uncontrolled. Default: 0

Default—
onValueChange?
((value: number) => void)

Called with the snapped value whenever a drag or key press changes it.

Default—
min?
number

Lowest value on the track. Default: 0

Default—
max?
number

Highest value on the track. Default: 100

Default—
disabled?
boolean

Ignores pointer and keyboard input. Default: false

Default—
aria-label?
string

Accessible name for the slider handle.

Default—
formatValueText?
((value: number) => string)

Announced instead of the raw number — pass one when the value carries a unit or a suffix ("72.5 kg", "35%"); a bare number needs no valueText.

Default—
sound?
boolean

Play a tiny tick per step, higher toward the max. Off by default; a `SoundProvider` can mute it app-wide.

Default—
Also on React Native. A bar thumb that glides between steps.

More in Range Slider

Updated