BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/nexvyn/bounce-sidebar

Bounce Sidebar

nexvyn/bounce-sidebar
FreeComponent

A sidebar navigation with a bouncing dot indicator that smoothly animates between items using spring physics.

Live preview

live · rendered by the registry
Rendered by nexvyn on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://ui.nexvyn.dev/r/bounce-sidebar.json

Source

components/ui/bounce-sidebar.tsxui.nexvyn.dev/r/bounce-sidebar.json
1'use client'
2
3import { useCallback, useEffect, useRef, useState, type KeyboardEvent } from 'react'
4import {
5 motion,
6 stagger,
7 useAnimate,
8 useMotionValue,
9 useReducedMotion,
10 type Transition,
11 type Variants,
12} from 'motion/react'
13import { cn } from '@/lib/utils'
14import { playHoverSound, playClickSound, playBounceSound } from '@/lib/sound'
15
16const EASE_OUT = [0.22, 1, 0.36, 1] as const
17
18export type BounceSidebarProps = {
19 items: string[]
20 value?: number
21 defaultValue?: number
22 onChange?: (index: number) => void
23 dotColor?: string
24 className?: string
25}
26
27const itemClass = (active: boolean) =>
28 cn(
29 'flex w-full cursor-pointer items-center rounded-lg p-1 text-left text-base',
30 'transition-colors duration-150',
31 'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-(--color-accent) focus-visible:ring-offset-1 focus-visible:ring-offset-(--color-bg)',
32 active ? 'text-foreground' : 'text-foreground/55',
33 )
34
35export function BounceSidebar({
36 items,
37 value,
38 defaultValue = 0,
39 onChange,
40 dotColor = 'var(--color-accent)',
41 className,
42}: BounceSidebarProps) {
43 const [internalValue, setInternalValue] = useState(defaultValue)
44 const activeIndex = value ?? internalValue
45
46 const [scope, animate] = useAnimate()
47 const itemRefs = useRef<(HTMLLIElement | null)[]>([])
48 const prevY = useRef<number | null>(null)
49
50 const reduceMotion = useReducedMotion()
51
52 const dotX = useMotionValue(0)
53 const dotY = useMotionValue(0)
54
55 const [dotSize, setDotSize] = useState(6)
56
57 const getTargetY = (index: number, size: number): number | null => {
58 const el = itemRefs.current[index]
59 if (!el) return null
60 const dpr = window.devicePixelRatio || 1
61 return Math.round((el.offsetTop + el.offsetHeight / 2 - size / 2) * dpr) / dpr
62 }
63
64 useEffect(() => {
65 let cancelled = false
66 const dpr = window.devicePixelRatio || 1
67 const computedSize = Math.round(6 * dpr) / dpr
68
69 const initialIndex = activeIndex
70 const snap = () => {
71 if (cancelled) return
72 const toY = getTargetY(initialIndex, computedSize)
73 if (toY === null) return
74 dotX.set(0)
75 dotY.set(toY)
76 prevY.current = toY
77 }
78
79 const ro = new ResizeObserver(snap)
80 itemRefs.current.forEach((el) => el && ro.observe(el))
81 setDotSize(computedSize)
82
83 const raf = requestAnimationFrame(snap)
84 document.fonts?.ready.then(snap)
85 return () => {
86 cancelled = true
87 cancelAnimationFrame(raf)
88 ro.disconnect()
89 }
90// … truncated

What it pulls in

npm packages

  • motion

Files it writes

  • components/ui/bounce-sidebar.tsx
  • lib/sound.ts

Facts

Registry
nexvyn
Type
registry:ui
Access
Free
Files written
2
Licence
MIT
First indexed
2026-08-01
Last confirmed
yesterday

Go to the source

Docs on nexvyn ui.nexvyn.dev Nexvyn/Nexvyn-ui on GitHub Raw registry item This item as JSON

More from nexvyn

All 33 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
BadgebadgenexvynComponentsFree2 deps · 2 files
Bars Themebars-themenexvynComponentsFree1 dep · 3 files
BreadcrumbsbreadcrumbsnexvynComponentsFree1 dep · 2 files
CheckboxcheckboxnexvynComponentsFree1 dep · 3 files
Clipboard Fieldclipboard-fieldnexvynComponentsFreeno deps · 2 files
Color Pickercolor-pickernexvynComponentsFreeno deps · 16 files
ComboboxcomboboxnexvynComponentsFree1 dep · 2 files
Context Menucontext-menunexvynComponentsFree1 dep · 2 files
BlockDex

Built by

Kynth Studio

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

BlockDex

BlockDex

Built by

Kynth Studio

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

BlockDex

BlockDex

Built by

Kynth Studio

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

BlockDex