Components
Bubble Slider
A slider with its value in a bubble over the thumb.
<BubbleSlider label="Brightness" />Installation
npx shadcn@latest add https://ui.zjkm.tech/r/bubble-slider.jsonimport { BubbleSlider } from "@/components/bubble-slider"Using JavaScript? Set tsx: false in components.json and the CLI converts it.
New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.
Usage
The value rides above the thumb in a small bubble, so the number sits right where you're looking.
import { BubbleSlider } from "@/components/bubble-slider";
export function Brightness() {
return <BubbleSlider label="Brightness" format={(v) => `${v}%`} />;
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | The label. | |
defaultValue | number | 50 | Starting value. |
min | number | 0 | Lowest value. |
max | number | 100 | Highest value. |
step | number | 1 | Step between values. |
format | (value: number) => string | String | Turns the value into the text shown and read out, e.g. v => `${v}%`. |
onChange | (value: number) => void | Called as the value changes. | |
color | string | "#4f46e5" | Bubble and fill colour. |
className | string | Classes for the wrapper. |
With reduced motion, the bubble moves without easing.