BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/nexvyn/dropdown-menu

Dropdown Menu

nexvyn/dropdown-menu
FreeComponent

A popover action menu with a proximity-driven morphing highlight. The muted hover highlight springs between items as the pointer moves, giving the menu a fluid, alive feel.

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/dropdown-menu.json

Source

components/ui/dropdown-menu.tsxui.nexvyn.dev/r/dropdown-menu.json · first 6 KB
1'use client'
2
3import {
4 createContext,
5 forwardRef,
6 useCallback,
7 useContext,
8 useEffect,
9 useId,
10 useLayoutEffect,
11 useMemo,
12 useRef,
13 useState,
14 type HTMLAttributes,
15 type ReactNode,
16} from 'react'
17import { createPortal } from 'react-dom'
18import { useReducedMotion, type MotionValue } from 'motion/react'
19import { cn } from '@/lib/utils'
20import { playHoverSound, playClickSound } from '@/lib/sound'
21import { useProximityHighlight, ProximityHighlight } from '@/lib/hooks/use-proximity-highlight'
22interface DropdownMenuContextValue {
23 open: boolean
24 setOpen: (next: boolean) => void
25 triggerId: string
26 contentId: string
27 nextIndex: () => number
28
29 itemsWidth: number | null
30 setItemsWidth: (w: number | null) => void
31}
32
33const DropdownMenuContext = createContext<DropdownMenuContextValue | null>(null)
34
35function useDropdownMenuCtx(componentName: string) {
36 const ctx = useContext(DropdownMenuContext)
37 if (!ctx) throw new Error(`${componentName} must be used within DropdownMenu`)
38 return ctx
39}
40interface DropdownMenuContentContextValue {
41 activeIndex: number | null
42 setActiveIndex: (i: number | null) => void
43 highlightX: ReturnType<typeof import('motion/react').useSpring>
44 highlightSize: MotionValue<number>
45 highlightOpacity: ReturnType<typeof import('motion/react').useSpring>
46 axis: 'x' | 'y'
47 focusedIndex: number
48 setFocusedIndex: (i: number) => void
49 setOpen: (next: boolean) => void
50
51 registerItem: (index: number, el: HTMLElement | null) => void
52}
53
54const DropdownMenuContentContext = createContext<DropdownMenuContentContextValue | null>(null)
55
56function useDropdownMenuContentCtx(componentName: string) {
57 const ctx = useContext(DropdownMenuContentContext)
58 if (!ctx) throw new Error(`${componentName} must be used within DropdownMenuContent`)
59 return ctx
60}
61export interface DropdownMenuProps {
62 children: ReactNode
63 open?: boolean
64 defaultOpen?: boolean
65 onOpenChange?: (open: boolean) => void
66 className?: string
67}
68
69export function DropdownMenu({
70 children,
71 open: openProp,
72 defaultOpen = false,
73 onOpenChange,
74 className,
75}: DropdownMenuProps) {
76 const isControlled = openProp !== undefined
77 const [internalOpen, setInternalOpen] = useState(defaultOpen)
78 const open = isControlled ? openProp : internalOpen
79 const [itemsWidth, setItemsWidth] = useState<number | null>(null)
80
81 const setOpen = useCallback(
82 (next: boolean) => {
83 if (!isControlled) setInternalOpen(next)
84 onOpenChange?.(next)
85 },
86// … truncated

What it pulls in

npm packages

  • motion

Files it writes

  • components/ui/dropdown-menu.tsx
  • lib/hooks/use-proximity-highlight.tsx
  • lib/sound.ts

Facts

Registry
nexvyn
Type
registry:ui
Access
Free
Files written
3
Licence
MIT
First indexed
2026-08-03
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
Bounce Sidebarbounce-sidebarnexvynComponentsFree1 dep · 2 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
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