DropdownMenu

Dropdown menus group secondary commands behind a compact trigger.

Overview and decision boundary

Use DropdownMenu to group secondary commands behind a compact trigger.

Do not hide the primary page action inside a menu.

import { Copy, UserPlus, X } from '@nerio-ui/adapters/icons';import { DropdownMenu } from '@nerio-ui/ui/client';<DropdownMenu  trigger="Actions"  items={[    { group: "Collaborate", label: "Share workspace", description: "Invite people and choose access", leadingIcon: UserPlus },    { group: "Collaborate", label: "Duplicate workspace", leadingIcon: Copy },    { group: "Manage", label: "Archive", leadingIcon: X, destructive: true },  ]}/>

Installation and imports

Install the editable registry source, or use the matching package entrypoint when the product keeps Nerio as a workspace dependency.

pnpm exec nerio add dropdown-menuimport { Copy, UserPlus, X } from '@nerio-ui/adapters/icons';import { DropdownMenu } from '@nerio-ui/ui/client';

Usage

import { Copy, UserPlus, X } from '@nerio-ui/adapters/icons';import { DropdownMenu } from '@nerio-ui/ui/client';<DropdownMenu  trigger="Actions"  items={[    { group: "Collaborate", label: "Share workspace", description: "Invite people and choose access", leadingIcon: UserPlus },    { group: "Collaborate", label: "Duplicate workspace", leadingIcon: Copy },    { group: "Manage", label: "Archive", leadingIcon: X, destructive: true },  ]}/>

Variants

VariantPurpose
defaultDefault variant using semantic Nerio tokens.
groupedGrouped is part of the public component contract.
destructiveRisky action that needs explicit intent.
descriptionDescription is part of the public component contract.
leading iconLeading icon is part of the public component contract.
trailing iconTrailing icon is part of the public component contract.
hotkeyHotkey is part of the public component contract.

Anatomy

SlotPurpose
contentLayered menu surface.
groupLabeled command cluster separated from adjacent groups.
group-labelGroup Label slot exposed through data-slot="group-label".
separatorSeparator slot exposed through data-slot="separator".
itemCommand row with optional description, group, leading icon, trailing icon, hotkey, and intent.
leading-iconLeading Icon slot exposed through data-slot="leading-icon".
labelLabel slot exposed through data-slot="label".
descriptionDescription slot exposed through data-slot="description".
hotkeyHotkey slot exposed through data-slot="hotkey".
trailing-iconTrailing Icon slot exposed through data-slot="trailing-icon".

States

StatePurpose
OpenItems are keyboard navigable.
HighlightedCurrent item is ready for selection.
DisabledUnavailable items stay in context without activation.

Motion

  • State changes should use shared motion tokens and preserve reduced-motion behavior.

Accessibility

  • Uses the Base UI Menu primitive.
  • Items are keyboard reachable and can be disabled.
  • Group labels and separators organize related commands without becoming menu items.
  • Optional descriptions are associated with their menu items through aria-describedby.
  • Pair the document dir attribute with Base UI DirectionProvider so menu navigation and positioned content follow LTR or RTL.
  • Disabled items stay visible but cannot be selected.
  • Use destructive tone only for irreversible or high-risk commands.
  • Supports controlled open, uncontrolled defaultOpen, onOpenChange, and a forwarded menu popup ref.

Review the shared responsibility and evidence boundaries in the Accessibility foundation alongside this component-specific contract. Use the Spacing & layout foundation for shared density, wrapping, overflow, reflow, and component-versus-product ownership guidance. The Color foundation, Typography foundation, and Localization foundation define the shared visual-role, text-resilience, direction, and locale boundaries used by component examples.

API

PropPurpose
itemsOrdered list of label, description, group, leadingIcon, trailingIcon, hotkey, onSelect, disabled, and destructive values.
descriptionAdds visible supporting context and an accessible description to an item.
groupCreates labeled, separated command clusters without custom menu markup.
disabled itemStays visible in context without activation.
destructive itemMarks risky commands without changing the whole menu tone.

Implementation contract

ContractValue
Registry itemdropdown-menu installs 8 source files into the configured components directory.
Base UImenu
Registry dependenciesbutton
Package dependencies@base-ui/react, @nerio-ui/adapters, clsx, react, tailwind-merge, tailwindcss

Styling contract

ContractValue
AuthoringComplete, statically detectable Tailwind CSS v4 recipes own component visuals.
ValuesSemantic and component --n-* variables remain the canonical customization layer.
OverridesCustomizable slots merge consumer className values with tailwindCn so conflicting utilities resolve deterministically.
Residual CSSOnly shared keyframes and scoped no-Preflight compatibility rules remain; there is no parallel visual selector layer.

Design notes

  • Use DropdownMenu to group secondary commands behind a compact trigger.

Do / do not

Do

Use for Rename, Duplicate, Archive, and similar secondary commands.

Do not

Do not hide the primary page action inside a menu.

Tokens

These are the primary customization points. Override semantic or component tokens instead of changing component source.

TokenPurpose
--n-dropdown-min-widthPublic customization point for this component contract.
--n-dropdown-item-padding-inlinePublic customization point for this component contract.
--n-dropdown-item-gapPublic customization point for this component contract.
--n-dropdown-radiusPublic customization point for this component contract.
--n-overlay-z-indexPublic customization point for this component contract.
--n-overlay-floating-z-indexPublic customization point for this component contract.
--n-overlay-backgroundPublic customization point for this component contract.
--n-overlay-borderPublic customization point for this component contract.
--n-overlay-foregroundPublic customization point for this component contract.
--n-overlay-foreground-mutedPublic customization point for this component contract.
--n-overlay-control-backgroundPublic customization point for this component contract.
--n-overlay-dividerPublic customization point for this component contract.
--n-overlay-surface-filterPublic customization point for this component contract.
--n-overlay-dangerPublic customization point for this component contract.
--n-overlay-shadowPublic customization point for this component contract.
--n-motion-hover-durationPublic customization point for this component contract.
--n-motion-hover-easingPublic customization point for this component contract.
--n-motion-overlay-enter-durationPublic customization point for this component contract.
--n-motion-overlay-enter-easingPublic customization point for this component contract.
--n-motion-overlay-exit-durationPublic customization point for this component contract.
--n-motion-overlay-exit-easingPublic customization point for this component contract.
--n-focus-ringPublic customization point for this component contract.