Dropdown Menu
A menu button with submenus, checkbox and radio items, shortcuts, typeahead and full keyboard support.
npx shadcn@latest add https://sundaeui.dev/r/dropdown-menu.jsonOverview
A dropdown that supports everything an application menu needs: plain actions with icons and shortcut hints, toggles, single-choice radio groups, section labels, separators, a disabled state, and a red destructive action kept visually apart.
Opened from the keyboard, focus lands on the first item. Arrow keys, Home and End move, typing jumps to matching items, and Escape closes and returns focus to the button. Submenus open on hover, Arrow Right or Enter, and Arrow Left closes them. Opened with a pointer, it doesn’t steal focus.
Use it for overflow menus, project and file actions, and view settings. For navigation between pages, use links instead.
When to use
- Moving between a handful of destinations or sections.
When not to use
- Large or deep hierarchies: use a sidebar or search.
Installation
pnpm dlx shadcn@latest add https://sundaeui.dev/r/dropdown-menu.jsonnpx shadcn@latest add https://sundaeui.dev/r/dropdown-menu.jsonyarn dlx shadcn@latest add https://sundaeui.dev/r/dropdown-menu.jsonbunx --bun shadcn@latest add https://sundaeui.dev/r/dropdown-menu.jsonWorks in any React project. Files are written to components/sundae/. Read the source in the stage’s Code view.
- No dependencies beyond React 18 or later.
- Copy dropdown-menu.tsx into components/sundae/.
- Make sure Tailwind scans that folder (v4 detects it automatically; v3 needs it in `content`).
- Import the component and use it as shown below.
Usage
import { DropdownMenu } from '@/components/sundae/dropdown-menu'
<DropdownMenu
trigger="Project"
items={[
{ label: 'New file', shortcut: '⌘N', onSelect: createFile },
{ type: 'submenu', label: 'Share', items: [{ label: 'Copy link', onSelect: copyLink }] },
{ type: 'separator' },
{ type: 'checkbox', label: 'Show grid', checked: grid, onChange: setGrid },
{ label: 'Delete project', danger: true, onSelect: confirmDelete },
]}
/>Props
| Prop | Type | Default |
|---|---|---|
trigger*Button content. | ReactNode | — |
items*item | checkbox | radio | submenu | separator | label. | MenuItem[] | — |
labelaria-label for icon-only triggers. | string | — |
alignEdge the menu aligns to. | 'start' | 'end' | 'start' |
Accessibility
- Implements the WAI-ARIA menu button pattern: menu, menuitem, menuitemcheckbox and menuitemradio, with aria-checked, aria-haspopup and aria-expanded.
- Arrow keys, Home, End, typeahead and Escape all work. Focus returns to the trigger on close.
- Disabled items stay in the reading order with aria-disabled.
Customization
- Pass align="end" for menus at the right edge of toolbars.
- Shortcut hints are display-only. Bind the real keys in your app.
FAQ
- Is Dropdown Menu free?
- Yes. Dropdown Menu is free for personal and commercial projects, with full source on this page.
- How do I install Dropdown Menu?
- Run npx shadcn@latest add https://sundaeui.dev/r/dropdown-menu.json. The files are written to components/sundae/. It has no dependencies beyond React 18 or later.
- Does Dropdown Menu support keyboard and screen readers?
- Implements the WAI-ARIA menu button pattern: menu, menuitem, menuitemcheckbox and menuitemradio, with aria-checked, aria-haspopup and aria-expanded. Arrow keys, Home, End, typeahead and Escape all work. Focus returns to the trigger on close.
- Does Dropdown Menu respect reduced motion?
- Yes. With prefers-reduced-motion set, decorative motion is removed and state changes are instant.
More like this
All navigation →- Pro
Command Palette
Navigation · Refined - Pro
Nav Dropdown
Navigation · Refined Taffy Tabs
Navigation · Playful- Pro
Kanban Board
Data · Understated - Pro
Collapsible Sidebar
Navigation · Refined Pulse KPI
Data · Understated