Skip to main content

Dropdown Menu

A zero-dependency portaled dropdown menu with a spring-gliding item highlight, stroke-draw checkbox items, automatic flip positioning, and keyboard typeahead.

action=idle·panel:bottom

Customize

Side offset (px)6
Align offset (px)0
Motion blur (px)4
Duration (ms)180
Speed1

Installation

npx shadcn@latest add @kinetic/dropdown-menu

Usage

Compose DropdownMenu, DropdownMenuTrigger and DropdownMenuContent with items.

import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuLabel,
  DropdownMenuSeparator,
  DropdownMenuShortcut,
  DropdownMenuTrigger,
} from "@/components/kinetic/ui/dropdown-menu";

export function AccountMenu() {
  return (
    <DropdownMenu>
      <DropdownMenuTrigger>Account</DropdownMenuTrigger>
      <DropdownMenuContent>
        <DropdownMenuLabel>My account</DropdownMenuLabel>
        <DropdownMenuItem>
          Profile <DropdownMenuShortcut>Ctrl+P</DropdownMenuShortcut>
        </DropdownMenuItem>
        <DropdownMenuSeparator />
        <DropdownMenuItem variant="destructive">Sign out</DropdownMenuItem>
      </DropdownMenuContent>
    </DropdownMenu>
  );
}

DropdownMenuTrigger accepts asChild to render your own element.

Placement

Set side (top or bottom), align (start, center, end), sideOffset, alignOffset and collisionPadding on DropdownMenuContent. The menu flips automatically when there is not enough room.

<DropdownMenuContent side="top" align="end" sideOffset={8}>
  ...
</DropdownMenuContent>

Portal

DropdownMenuContent mounts into document.body automatically. Wrap it in DropdownMenuPortal and pass container to portal into a custom DOM node cleanly without double-portaling.

import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuPortal,
  DropdownMenuTrigger,
} from "@/components/kinetic/ui/dropdown-menu";

<DropdownMenu>
  <DropdownMenuTrigger>Actions</DropdownMenuTrigger>
  <DropdownMenuPortal container={portalContainer}>
    <DropdownMenuContent>
      <DropdownMenuItem>Duplicate</DropdownMenuItem>
    </DropdownMenuContent>
  </DropdownMenuPortal>
</DropdownMenu>

Items

DropdownMenuItem supports variant (default or destructive), inset, disabled, closeOnSelect and onSelect. Use DropdownMenuGroup to group related items.

<DropdownMenuItem inset closeOnSelect={false} onSelect={() => refresh()}>
  Refresh
</DropdownMenuItem>

Checkbox items

DropdownMenuCheckboxItem draws its check mark with an SVG stroke. Use checked with onCheckedChange, or defaultChecked.

<DropdownMenuCheckboxItem checked={showGrid} onCheckedChange={setShowGrid}>
  Show grid
</DropdownMenuCheckboxItem>

Radio items

Wrap DropdownMenuRadioItem elements, each with a value, in a DropdownMenuRadioGroup.

<DropdownMenuRadioGroup value={density} onValueChange={setDensity}>
  <DropdownMenuRadioItem value="compact">Compact</DropdownMenuRadioItem>
  <DropdownMenuRadioItem value="comfortable">Comfortable</DropdownMenuRadioItem>
</DropdownMenuRadioGroup>

Nest DropdownMenuSub, DropdownMenuSubTrigger and DropdownMenuSubContent inside the content. DropdownMenuSub accepts openDelay and closeDelay.

<DropdownMenuSub>
  <DropdownMenuSubTrigger>Share</DropdownMenuSubTrigger>
  <DropdownMenuSubContent>
    <DropdownMenuItem>Copy link</DropdownMenuItem>
  </DropdownMenuSubContent>
</DropdownMenuSub>

Keyboard

Arrow keys move the highlight, Home and End jump to the first and last item, typing characters jumps to a matching item, and Escape closes the menu and returns focus to the trigger.

Motion preferences

The item highlight glides on a spring. Tune it with speed, stiffness, damping and blurPx on DropdownMenu. Timing follows the current Kinetic tempo, and motion is simplified when reduced motion is enabled.

API Reference

DropdownMenu

Zero-dependency dropdown menu root managing open state, spring highlight physics, and timing.

PropTypeDefaultDescription
open / defaultOpen / onOpenChangeboolean / (open: boolean) => void-Controlled or uncontrolled menu visibility.
speednumber1Playback speed multiplier for menu reveal and highlight spring.
stiffness / dampingnumber420 / 32Spring parameters for the gliding row highlight.

DropdownMenuContent

Portaled menu panel with auto top/bottom flip, origin scale reveal, and keyboard typeahead.

PropTypeDefaultDescription
side"top" | "bottom""bottom"Preferred vertical side relative to trigger.
align"start" | "center" | "end""start"Horizontal alignment relative to trigger.
sideOffsetnumber6Pixel gap between trigger and menu content.

DropdownMenuPortal / DropdownMenuTrigger

Optional explicit portal wrapper with custom container target and asChild trigger button.

PropTypeDefaultDescription
container (DropdownMenuPortal)Element | nulldocument.bodyDOM element where DropdownMenuContent is mounted when wrapped in DropdownMenuPortal.
asChild (DropdownMenuTrigger)booleanfalseMerges menu trigger attributes and click/keyboard handlers onto a child element.

DropdownMenuItem / DropdownMenuCheckboxItem

Action and checkable rows with spring highlight tracking and SVG stroke-draw checkmarks.

PropTypeDefaultDescription
variant (DropdownMenuItem)"default" | "destructive""default"Switches row and highlight tint for destructive actions.
checked / onCheckedChange (CheckboxItem)boolean / (checked: boolean) => void-Controlled toggle state for checkable menu items.

Notes

Always place DropdownMenuItem, DropdownMenuLabel, and DropdownMenuSub inside DropdownMenuGroup (or DropdownMenuRadioGroup for radio items). Omit explicit size-* classes on child icons.