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
| Prop | Type | Default | Description |
|---|---|---|---|
| DropdownMenu.open / defaultOpen | boolean | — | Controlled or uncontrolled open state on the DropdownMenu root. |
| DropdownMenuContent.sideOffset | number | 8 | Distance in pixels between trigger and menu panel. |
| DropdownMenuContent.align | "start" | "center" | "end" | "start" | Alignment of the menu panel relative to its trigger. |
| DropdownMenuContent.container | HTMLElement | null | modal or body | Optional portal container override; defaults to nearest Dialog/Sheet portal container. |
| DropdownMenuItem.variant | "default" | "destructive" | "default" | Applies destructive semantic text color for irreversible actions. |
| DropdownMenuItem.disabled | boolean | false | Prevents selection and renders with disabled-foreground without opacity. |
Sizes and tokens
| Tier / Role | Token | Value |
|---|---|---|
| Menu width & item height | min-w-[12rem] / --control-height-sm | 192px min-width · 32px item height · 8px px-2 · 4px radius-sm |
| Leading icon & shortcut | size-4 / --text-caption | 16px icon slot · monospace 12px right-aligned shortcut |
| Surface & elevation | --popover / --popover-foreground / --shadow-md / --z-dropdown | Step 3 surface · 1px border · radius-md (8px) · z-index 20 |
| Motion | --duration-162 / --duration-100 | Fade + 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, orArrowDown; navigates items with arrow keys,Home,End, and character typeahead; closes onEscapeand returns focus to the trigger. DropdownMenuCheckboxItemandDropdownMenuRadioItemexposearia-checkedand render LucideCheckor a filled dot in a 16px leading slot.- Inside
DialogorSheet,DropdownMenuContentautomatically portals into the modal's container so it stays interactive abovez-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.