Animated Dropdown
A composable, fully accessible dropdown menu built on Base UI with a spring-driven shared hover highlight and origin-aware scale/fade animations. No hardcoded items — compose your own content.
Features
- Composable API —
AnimatedDropdown/Trigger/Content/Item/Separator, shadcn-style. - Spring hover highlight — shared
layoutIdglides between items as you move the mouse. - Per-instance isolation —
useId()scopes the layout group so multiple dropdowns on the same page never conflict. - Origin-aware animation — popup scales in from the trigger position using Base UI's
--transform-origin. - Icon-agnostic — pass any
ReactNodeas theiconprop. - Danger variant — red-tinted destructive items.
- Controlled or uncontrolled — use
open/onOpenChangeordefaultOpenas needed. - Full accessibility — keyboard nav, typeahead, focus trap, and portal via Base UI.
- Reduced-motion safe — instant transitions when the OS prefers reduced motion.
Playground
Try different side and align positions.
Installation
Usage
Examples
Danger variant
Use variant="danger" on destructive items — they get a red tint and are visually separated.
Controlled open state
Pass open and onOpenChange to fully control the dropdown from external state.
Dropdown is: closed
Code Examples
Basic usage
my-dropdown.tsx
Controlled state
controlled-dropdown.tsx
Side and alignment
positioned-dropdown.tsx
Props
| Property | Type | Default | Description |
|---|---|---|---|
children | ReactNode | required | |
open | boolean | — | Controlled open state. |
defaultOpen | boolean | false | Initial open state for uncontrolled usage. |
onOpenChange | (open: boolean) => void | — | Callback when open state changes. |
disabled | boolean | false | Whether the menu ignores user interaction. |
modal | boolean | true | Whether the open menu limits interaction to the menu. |