BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/cubby-ui/dropdown-menu

Dropdown-menu

cubby-ui/dropdown-menu
FreeComponent

A dropdown-menu component.

Live preview

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

Install it

npx shadcn@latest add https://cubby-ui.dev/r/dropdown-menu.json

Source

registry/default/dropdown-menu/dropdown-menu.tsxcubby-ui.dev/r/dropdown-menu.json · first 6 KB
1"use client";
2
3import * as React from "react";
4import { Menu as BaseMenu } from "@base-ui/react/menu";
5import { HugeiconsIcon } from "@hugeicons/react";
6import { ArrowRight01Icon, Tick02Icon } from "@hugeicons/core-free-icons";
7
8import { cn } from "@/lib/utils";
9import {
10 solidSurface,
11 type SurfaceLevel,
12} from "@/registry/default/lib/elevated";
13import {
14 SwitchVisual,
15 type SwitchVisualProps,
16} from "@/registry/default/switch/switch";
17
18// Shared shell for checkbox and radio items. Padding matches the plain menu
19// item so labels line up across every item type; the indicator lives in a
20// reserved right-hand column so toggling never shifts the label.
21const toggleItemClasses =
22 "group/switch data-highlighted:bg-surface-hover data-highlighted:text-accent-foreground grid cursor-default items-center rounded-md px-2.5 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-60 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4";
23
24// The tick draws itself in on check. `pathLength` restates the path as 1 unit
25// long, so the dash values are fractions of the stroke and survive a HugeIcons
26// reshape. Deriving the icon array is the only way to reach the path.
27const tickIcon = Tick02Icon.map(([tag, attrs]) => [
28 tag,
29 { ...attrs, pathLength: 1 },
30]) as typeof Tick02Icon;
31
32const checkmarkClasses =
33 "[&_path]:ease-out-expo [&_path]:transition-[stroke-dashoffset] [&_path]:duration-150 [&_path]:[stroke-dasharray:1] in-data-checked:[&_path]:[stroke-dashoffset:0] in-data-unchecked:[&_path]:[stroke-dashoffset:1] motion-reduce:[&_path]:transition-none";
34
35function DropdownMenu<Payload = unknown>({
36 ...props
37}: BaseMenu.Root.Props<Payload>) {
38 return <BaseMenu.Root data-slot="dropdown-menu" {...props} />;
39}
40
41function DropdownMenuPortal({
42 ...props
43}: React.ComponentProps<typeof BaseMenu.Portal>) {
44 return <BaseMenu.Portal data-slot="dropdown-menu-portal" {...props} />;
45}
46
47function DropdownMenuTrigger({
48 ...props
49}: React.ComponentProps<typeof BaseMenu.Trigger>) {
50 return <BaseMenu.Trigger data-slot="dropdown-menu-trigger" {...props} />;
51}
52
53function DropdownMenuPositioner({
54 ...props
55}: React.ComponentProps<typeof BaseMenu.Positioner>) {
56 return (
57 <BaseMenu.Positioner data-slot="dropdown-menu-positioner" {...props} />
58 );
59}
60
61function DropdownMenuContent({
62 className,
63 children,
64 sideOffset = 4,
65// … truncated

What it pulls in

npm packages

  • @hugeicons/react
  • @hugeicons/core-free-icons

Other registry items

  • @cubby-ui/switch
  • @cubby-ui/elevated

Files it writes

  • registry/default/dropdown-menu/dropdown-menu.tsx

Facts

Registry
cubby-ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-01
Last confirmed
today

Go to the source

Docs on cubby-ui cubby-ui.dev joncoronel/cubby-ui on GitHub Raw registry item This item as JSON

More from cubby-ui

All 79 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordioncubby-uiComponentsFree2 deps
Alertalertcubby-uiComponentsFree1 dep
Alert-dialogalert-dialogcubby-uiComponentsFree2 deps
Aspect-ratioaspect-ratiocubby-uiComponentsFreeno deps
Autocompleteautocompletecubby-uiComponentsFree2 deps
Avataravatarcubby-uiComponentsFree1 dep
Badgebadgecubby-uiComponentsFree1 dep
Base Drawerbase-drawercubby-uiComponentsFree2 deps
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