Bubble Slider
betaA slider whose pill thumb shows the value, stretches with speed and rubber-bands past the ends of the track.
- Forms
- 1 file
- 2 npm packages
- Accessibility notes
Loading the example…
pnpm dlx @dowel-ui/cli add bubble-slidernpm packages installed: class-variance-authority, radix-ui.
import { BubbleSlider } from "@/components/ui/bubble-slider";Default
Demo Story
With Units
<BubbleSlider>
| Prop | Type | Default |
|---|---|---|
defaultValueInitial value when uncontrolled. Defaults to | number | — |
formatValueText shown in the bubble and spoken as aria-valuetext, e.g. for units. | (value: number) => string | — |
onValueChangeCalled on every change while dragging or keying. | (value: number) => void | — |
onValueCommitCalled when an interaction ends: pointer released or key pressed. | (value: number) => void | — |
size | "sm" | "md" | "lg" | "md" |
ticksNumber of ticks under the track. 0 hides them. Defaults to 11. | number | 11 |
valueControlled value. | number | — |
Every prop of Radix UI’s Slider.Root, plus className.
Built on the Radix slider: the thumb is role="slider" with aria-valuenow, aria-valuemin and aria-valuemax, and responds to Arrow keys, Page Up/Down, Home and End, with a visible focus ring. It has no visible label, so name it with aria-label or aria-labelledby. The number drawn in the bubble and the ticks are aria-hidden; `formatValue` sets both the bubble text and aria-valuetext, so units are spoken. Radix mirrors the slider in right-to-left layouts. Under reduced motion the bubble neither stretches nor springs.
10/10
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — passes
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — passes
- No fixed widths — passes