A comprehensive dropdown menu system with morphing animations, keyboard navigation, and full accessibility support. Built on Radix UI primitives with Motion spring physics for buttery-smooth interactions.
Copy and paste the following code into your project.
This will also install: motion-provider
The simplest dropdown menu requires just a Root, Trigger, Content, and Item components. Use the Separator to visually group related items.
Enhance menu items with leading icons and trailing keyboard shortcuts using the Shortcut sub-component. Icons are placed before text with mr-2 spacing.
Use CheckboxItem for toggle-able boolean options. Each item manages its own state via checked and onCheckedChange props, with smooth animated checkmarks.
For mutually exclusive selections, wrap RadioItem components inside a RadioGroup. The group manages the selected value via value and onValueChange props.
Create nested navigation using Sub, SubTrigger, and SubContent. Use controlled state with open and onOpenChange to sync the trigger button state.
Container component that manages dropdown state and provides context.
Main dropdown panel with animations and positioning.
Interactive menu item with stagger animations.
Toggleable checkbox item with animated indicator.
Radio selection group with animated indicators.
Nested submenu container for hierarchical menus.
Full WAI-ARIA menu button pattern with semantic roles and comprehensive keyboard support. Built on Radix UI primitives for battle-tested accessibility.
aria-haspopup="menu"aria-expanded for open state.role="menu"role="menuitem"Animation Features
prefers-reduced-motion