Ballmac UI home

Slider

A single or range slider with a name per thumb, a live value bubble, vertical orientation and full keyboard control, built on Radix.

Volume

Price range

Installation

$ pnpm dlx shadcn@latest add @ballmac/slider

Usage

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

The full example is in the Code tab above.

Examples

Vertical and disabled

API reference

PropTypeDefault
value

Controlled value. One number per thumb.

number[]—
defaultValue

Initial value when uncontrolled. One number per thumb; two numbers make a range.

number[]—
thumbLabels

Accessible name for each thumb, in order, for example `["Minimum", "Maximum"]`. A single-thumb slider can use `aria-label` or `aria-labelledby`, which are passed to the thumb.

string[]—
showValue

Show a value bubble above the thumb while it is hovered, focused or dragged.

booleanfalse
formatValue

Format the number shown in the bubble and announced as `aria-valuetext`.

(value: number) => string—

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
ArrowLeft / ArrowRight / ArrowUp / ArrowDownChanges the value by one step
PageUp / PageDownChanges by a larger step
Home / EndJumps to min or max
TabMoves between thumbs

Use with AI

Drag or use the keyboard to pick a number or a range. Give every thumb a name with thumbLabels; showValue adds a bubble on hover, focus and drag. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Slider (@ballmac/slider) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Volume, brightness and zoom
  • Price and date ranges with two thumbs
  • Any bounded numeric choice where precision is not critical

Not for

  • Exact numeric entry; use number-input
  • A styled range with marks or steps shown; use slider-range

Registry JSON: https://ui.ballmac.com/r/slider.json

Credits

Based on shadcn/ui Slider, adapted by Ballmac. Free to use in personal and commercial projects.