Dropdown Menu
A menu of actions or options revealed by a trigger.
- Status
- Ready
- Code
- In React
- Role
- Action
Usage
This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.
Choose a format.
Pastes as editable layers. Shadows are not exported.
import { useState } from "react";
import { DownloadSimple } from "@phosphor-icons/react";
import { DropdownMenu, type MenuItemData } from "@/ui";
const EXPORT_ITEMS: MenuItemData[] = [{ label: "CSV" }, { label: "PDF" }, { label: "Excel" }];
export default function DropdownMenuDemo() {
const [format, setFormat] = useState<string>("");
const items: MenuItemData[] = EXPORT_ITEMS.map((it) => ({ ...it, onSelect: () => setFormat(it.label) }));
return (
<>
<DropdownMenu label="Export" icon={<DownloadSimple size={18} />} items={items} />
<p aria-live="polite">{format ? "Exporting as " + format + "." : "Choose a format."}</p>
</>
);
}Variants and states
Every specimen is the real component from src/ui, held in one state.
Pastes as editable layers. Shadows are not exported.
Props
- label
- string · default none
- Required. The button text, which also names the menu.
- items
- { label, icon?, onSelect?, danger?, disabled?, separatorBefore? }[] · default none
- Required. The actions. separatorBefore starts a new group with a divider.
- icon
- ReactNode · default none
- An icon before the label.
- variant
- "secondary" | "ghost" | "primary" | "inverse" · default "secondary"
- The trigger's Button variant.
- size
- "sm" | "md" · default "md"
- Text and icon size of the items. Items stay 44px tall.
- align
- "start" | "end" · default "start"
- Which edge of the trigger the list lines up with. Use end near the right edge of the screen.
- className
- string · default ""
- Extra classes on the wrapper.
Figma to code
Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.
- 🧰 Type
- variant
- The trigger button's variant.
- 🖍 Label
- label
- The trigger text.
- Menu Item · 📐 Size
- size
- sm or md.
- Menu Item · 🎯 State
- items[].disabled, items[].danger
- Default, Hover (browser), Disabled, Danger.
- Show Icon Left, Change Icon Left
- icon, items[].icon
- On the trigger and per item.
Accessibility
What the code in src/ui does today, and what it leaves to you.
Keyboard
- Enter or Space on the trigger opens the menu and moves focus to the first item.
- Up and Down move between items, Home and End jump to the ends, and disabled items are skipped.
- Enter picks an item. Escape or Tab closes the menu, and Escape returns focus to the trigger.
Screen readers
- The ARIA menu pattern: aria-haspopup="menu" and aria-expanded on the trigger, role=menu and role=menuitem in the list.
- The caret and icons are aria-hidden, so the trigger is read by its label.
What you still need to do
- Use it for actions. For choosing a value in a form, use Select or Combobox.
- Confirm a destructive item before it runs.
- This component draws no focus indicator of its own. On this site a global :focus-visible rule draws a 2px outline in the border/focus role (--color-role-border-focus). Copy the role tokens and that rule, or an equivalent, into your app.
When to use
Reach for it when there are more actions than fit inline.
Do and don't
Do
- Group related items with dividers.
- Order items by frequency of use.
Don't
- Nest more than one level of submenu.
- Hide destructive actions among safe ones without separation.
Related
4 of 28 other molecules, same role and ready ones first.
- More MenuAn overflow menu (kebab / ellipsis) for secondary or less-used actions.Ready
- AccordionStacked sections that expand to reveal their content.Ready
- AlertA persistent, inline message that communicates important information.Ready
- Amount InputAn input for money that formats the value as the user types.Ready
Status reflects the component tracker snapshot of 29 October 2026.