Skip to content
ComponentsMarkdown

Dropdown

Floating action menu anchored to a trigger, built on Radix DropdownMenu. Supports action items, checkbox toggles, radio groups, and keyboard shortcuts on the shared popupSurface.

Live example

Props

PropTypeDefaultDescription
DropdownMenu.open / defaultOpenboolean—Controlled or uncontrolled open state on the DropdownMenu root.
DropdownMenuContent.sideOffsetnumber8Distance in pixels between trigger and menu panel.
DropdownMenuContent.align"start" | "center" | "end""start"Alignment of the menu panel relative to its trigger.
DropdownMenuContent.containerHTMLElement | nullmodal or bodyOptional portal container override; defaults to nearest Dialog/Sheet portal container.
DropdownMenuItem.variant"default" | "destructive""default"Applies destructive semantic text color for irreversible actions.
DropdownMenuItem.disabledbooleanfalsePrevents selection and renders with disabled-foreground without opacity.

Sizes and tokens

Tier / RoleTokenValue
Menu width & item heightmin-w-[12rem] / --control-height-sm192px min-width · 32px item height · 8px px-2 · 4px radius-sm
Leading icon & shortcutsize-4 / --text-caption16px icon slot · monospace 12px right-aligned shortcut
Surface & elevation--popover / --popover-foreground / --shadow-md / --z-dropdownStep 3 surface · 1px border · radius-md (8px) · z-index 20
Motion--duration-162 / --duration-100Fade + scale 0.96→1 (162ms enter, 100ms exit); opacity-only when reduced

States

Code

import {
  Button,
  DropdownMenu,
  DropdownMenuCheckboxItem,
  DropdownMenuContent,
  DropdownMenuGroup,
  DropdownMenuItem,
  DropdownMenuLabel,
  DropdownMenuRadioGroup,
  DropdownMenuRadioItem,
  DropdownMenuSeparator,
  DropdownMenuShortcut,
  DropdownMenuTrigger,
} from "@freshgemui/monoplinth";

export function Example() {
  return (
    <DropdownMenu>
      <DropdownMenuTrigger asChild>
        <Button variant="outline">Actions</Button>
      </DropdownMenuTrigger>
      <DropdownMenuContent>
        <DropdownMenuLabel>Workspace</DropdownMenuLabel>
        <DropdownMenuGroup>
          <DropdownMenuItem>
            Duplicate
            <DropdownMenuShortcut>⌘D</DropdownMenuShortcut>
          </DropdownMenuItem>
          <DropdownMenuCheckboxItem checked>
            Show tokens
          </DropdownMenuCheckboxItem>
        </DropdownMenuGroup>
        <DropdownMenuSeparator />
        <DropdownMenuRadioGroup value="comfortable">
          <DropdownMenuRadioItem value="compact">Compact</DropdownMenuRadioItem>
          <DropdownMenuRadioItem value="comfortable">
            Comfortable
          </DropdownMenuRadioItem>
        </DropdownMenuRadioGroup>
        <DropdownMenuSeparator />
        <DropdownMenuItem variant="destructive">Delete</DropdownMenuItem>
      </DropdownMenuContent>
    </DropdownMenu>
  );
}

Do and don't

Do: Use DropdownMenu for action lists and view toggles
Group related commands with labels and separators, and mark irreversible actions with variant='destructive'.
Don't: Use DropdownMenu as a form field
Use Select when the user is choosing a single value inside a form with validation.

Accessibility

  • Opens with Enter, Space, or ArrowDown; navigates items with arrow keys, Home, End, and character typeahead; closes on Escape and returns focus to the trigger.
  • DropdownMenuCheckboxItem and DropdownMenuRadioItem expose aria-checked and render Lucide Check or a filled dot in a 16px leading slot.
  • Inside Dialog or Sheet, DropdownMenuContent automatically portals into the modal's container so it stays interactive above z-modal.

Rationale

Aligning menu items to --control-height-sm (32px) and sharing popupSurface with Select and Popover keeps floating menus compact, crisp, and visually unified.