BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/beui/range-slider-bubble

Range Slider Bubble Slider

beui/range-slider-bubble
FreeComponent

Grab the thumb and a value bubble pops out of it. The bubble tilts and squashes with how fast you drag, then settles upright.

Install it

npx shadcn@latest add https://beui.dev/r/range-slider-bubble.json

Source

components/motion/range-slider-bubble.tsxbeui.dev/r/range-slider-bubble.json
1"use client";
2// beui.dev/components/motion/range-slider
3
4import {
5 AnimatePresence,
6 motion,
7 useMotionTemplate,
8 useMotionValue,
9 useReducedMotion,
10 useSpring,
11 useTransform,
12 useVelocity,
13} from "motion/react";
14import { useEffect } from "react";
15
16import { SPRING_GLIDE, SPRING_PANEL, SPRING_PRESS } from "@/lib/ease";
17import { type SliderOptions, useSlider } from "@/lib/hooks/use-slider";
18import { cn } from "@/lib/utils";
19
20// Loose enough that the bubble keeps leaning a beat after the pointer stops.
21const SPRING_TILT = { stiffness: 260, damping: 22, mass: 0.4 } as const;
22/** Drag speed (px/s of track percent) that maxes out lean and squash. */
23const FULL_TILT = 320;
24
25export interface BubbleSliderProps extends SliderOptions {
26 /** Formats the value shown in the bubble. */
27 format?: (value: number) => string;
28 className?: string;
29}
30
31/**
32 * Slider with a value bubble that pops out of the thumb on grab and reacts to
33 * how fast you drag: it leans into the direction of travel and squashes along
34 * the way, then settles upright when you let go.
35 */
36export function BubbleSlider({ format, className, ...options }: BubbleSliderProps) {
37 const reduce = useReducedMotion();
38 // A bare number needs no valueText — it would only repeat aria-valuenow.
39 const { percent, current, dragging, trackProps, sliderProps } = useSlider({
40 ...options,
41 formatValueText: options.formatValueText ?? format,
42 });
43 // The value is already snapped to the step — rounding here would only make
44 // the bubble disagree with aria-valuenow on a fractional scale.
45 const readout = format ? format(current) : current;
46
47 const target = useMotionValue(percent);
48 useEffect(() => {
49 target.set(percent);
50 }, [percent, target]);
51 const smooth = useSpring(target, SPRING_GLIDE);
52 const pos = reduce ? target : smooth;
53 const left = useMotionTemplate`${pos}%`;
54
55 // One spring drives the whole reaction: lean is signed, squash reads its
56 // magnitude. Two springs off the same velocity would just run twice.
57 const velocity = useVelocity(pos);
58 const lean = useSpring(
59 useTransform(velocity, [-FULL_TILT, 0, FULL_TILT], [1, 0, -1], { clamp: true }),
60 SPRING_TILT,
61 );
62 const tilt = useTransform(lean, (v) => v * 16);
63 const squash = useTransform(lean, (v) => 1 + Math.abs(v) * 0.18);
64 const stretch = useTransform(lean, (v) => 1 - Math.abs(v) * 0.12);
65
66 return (
67 <div
68 className={cn(
69// … truncated

What it pulls in

npm packages

  • clsx
  • motion
  • tailwind-merge

Files it writes

  • components/motion/range-slider-bubble.tsx
  • lib/ease.ts
  • lib/hooks/use-slider.ts
  • lib/utils.ts

Facts

Registry
beui
Type
registry:component
Access
Free
Files written
4
Licence
the repository states none
First indexed
2026-08-12
Last confirmed
today

Go to the source

beui.dev Raw registry item This item as JSON

More from beui

All 104 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Action Swap Bluraction-swap-blurbeuiComponentsFree3 deps · 4 files
Action Swap Cascadeaction-swap-cascadebeuiComponentsFree3 deps · 4 files
Action Swap Rollaction-swap-rollbeuiComponentsFree3 deps · 4 files
Agent Activityagent-activitybeuiComponentsFree4 deps · 9 files
Agent Loading States Agent Progressagent-progressbeuiComponentsFree3 deps · 3 files
AI Sidebarai-sidebarbeuiComponentsFree4 deps · 5 files
Animated Badgeanimated-badgebeuiComponentsFree4 deps · 3 files
Number Animation Animated Numberanimated-numberbeuiComponentsFree3 deps · 3 files
BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex