Components

Dropdown Menu

The shadcn/ui Dropdown Menu with menus that grow out of their trigger, smooth item highlights and indicators that fade in — plus an animated React dropdown menu block built with Motion and Radix, with staggered items and a highlight pill that glides between them.

  • Drop-in shadcn API
  • Radix keyboard & typeahead
  • Sub-menus
  • Motion block

Installation

$ npx shadcn@latest add https://duskui.com/r/dropdown-menu.json

Replaces components/ui/dropdown-menu.tsx with the same exports and props (including inset and variant="destructive"). Animations are CSS (tw-animate-css), so the base needs no Motion.

Usage

account-menu.tsx
import { Button } from "@/components/ui/button"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuLabel,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"

export function AccountMenu() {
  return (
    <DropdownMenu>
      <DropdownMenuTrigger asChild>
        <Button variant="outline">Account</Button>
      </DropdownMenuTrigger>
      <DropdownMenuContent align="start">
        <DropdownMenuLabel>My account</DropdownMenuLabel>
        <DropdownMenuItem>Profile</DropdownMenuItem>
        <DropdownMenuItem>Billing</DropdownMenuItem>
        <DropdownMenuSeparator />
        <DropdownMenuItem variant="destructive">Log out</DropdownMenuItem>
      </DropdownMenuContent>
    </DropdownMenu>
  )
}

Examples

Default

The menu scales out of the trigger (using Radix's transform origin) and slides in from the side it opens on, then closes faster than it opened. Includes groups, shortcuts, a disabled item, a sub-menu, and a destructive item.

Checkboxes & radio group

Check marks and radio dots fade in when selected. Call event.preventDefault() in onSelect to keep the menu open while toggling several options.

Blocks

Ready-made variations composed from the base component with Motion. Each installs on its own and pulls in its dependencies automatically.

Animated Dropdown

A dropdown that opens from its trigger's side while items cascade in. A highlight pill glides between items as you hover or arrow through them (a shared Motion layoutId), the hovered item's icon brightens, and separators draw in. It's still Radix underneath: focus, typeahead, arrow keys, Escape and aria all work.

$ npx shadcn@latest add https://duskui.com/r/animated-dropdown.json
PropTypeDefaultDescription
open / defaultOpen / onOpenChangeboolean / boolean / (open: boolean) => void—Open state (on AnimatedDropdown).
AnimatedDropdownTriggerRadix Trigger props—Use asChild to render your own Button.
AnimatedDropdownContentRadix Content props & { stagger?: number }—side, align, sideOffset… stagger is the delay between items in seconds (default 0.035).
AnimatedDropdownItemRadix Item props & { icon?, shortcut?, variant? }—An action. variant="destructive" tints it red.
AnimatedDropdownLabel / Separator / GroupRadix props—Headings, dividers and groups that animate with the items.

API Reference

Same parts as shadcn/ui: DropdownMenu, Trigger, Content, Item, CheckboxItem, RadioGroup, RadioItem, Label, Separator, Shortcut, Group, Portal, Sub, SubTrigger and SubContent (all prefixed DropdownMenu). Each forwards the Radix props.

PropTypeDefaultDescription
open / onOpenChangeboolean / (open: boolean) => void—Controlled state (on DropdownMenu).
side / align / sideOffsetstring / string / number"bottom" / "center" / 6Placement (on DropdownMenuContent).
onSelect(event: Event) => void—Fires on click, Enter or Space; preventDefault() keeps the menu open (on items).
variant"default" | "destructive""default"Red destructive item (on DropdownMenuItem).
insetboolean—Indent to align with items that have an indicator (Item, Label, SubTrigger).
checked / onCheckedChangeboolean / (checked: boolean) => void—On DropdownMenuCheckboxItem.

Accessibility

  • Built on Radix Dropdown Menu: role="menu" with menuitem, menuitemcheckbox and menuitemradio roles, roving focus, typeahead, and focus returned to the trigger on close.
  • Arrow keys move between items, Right/Left open and close sub-menus, Enter/Space select and Escape closes.
  • In the Animated Dropdown the highlight pill follows keyboard focus as well as the pointer, so keyboard users see the same feedback.
  • Under prefers-reduced-motion menus only fade, the item cascade is removed and the highlight jumps instead of gliding.