Dropdown menu

On this page

InstallationUsageCompositionExamplesGroups and labelsSeparatorsIconsShortcutsDescriptionsBadgesA badge after the textA status's dotCheck itemsA switchRadio groupSubmenuA submenu with a searchDestructiveDisabledEnd actionRunning an actionKeep the menu openLong menusSearchSizesA row's own sizeWidthPlacementA row's menuControlledNon-modalIn a containerAPI ReferenceDropdownMenuDropdownMenuTriggerDropdownMenuContentDropdownMenuGroupDropdownMenuLabelDropdownMenuItemDropdownMenuRadioGroupDropdownMenuSeparatorDropdownMenuSubDropdownMenuSubTriggerDropdownMenuSubContentDropdownMenuRowKeyboardRulesWritten downOpen questions

Dropdown menu

A list of actions or choices that opens from a button: rows in groups with labels, icons, shortcuts, checks and submenus, and a scrolling list with a search when it runs long.

1<DropdownMenu>2  <DropdownMenuTrigger render={<Button iconEnd={ChevronDownSmall} />}>Actions</DropdownMenuTrigger>3  <DropdownMenuContent width={240}>4    <DropdownMenuGroup separator>5      <DropdownMenuLabel>Agent</DropdownMenuLabel>6      <DropdownMenuItem iconStart={PencilSquare} shortcut="⌘E">Edit</DropdownMenuItem>7      <DropdownMenuItem iconStart={Copy} shortcut="⌘D">Duplicate</DropdownMenuItem>8      <DropdownMenuItem9        iconStart={Folder}10        submenu={11          <>12            <DropdownMenuItem>Production</DropdownMenuItem>13            <DropdownMenuItem>Staging</DropdownMenuItem>14            <DropdownMenuItem>Development</DropdownMenuItem>15          </>16        }17      >18        Move to19      </DropdownMenuItem>20    </DropdownMenuGroup>21    <DropdownMenuGroup separator>22      <DropdownMenuLabel>View</DropdownMenuLabel>23      <DropdownMenuItem indicator="checkbox" checked={archived} onCheckedChange={setArchived}>Show archived</DropdownMenuItem>24      <DropdownMenuItem indicator="checkbox" checked={compact} onCheckedChange={setCompact}>Compact rows</DropdownMenuItem>25    </DropdownMenuGroup>26    <DropdownMenuGroup separator>27      <DropdownMenuLabel>Share</DropdownMenuLabel>28      <DropdownMenuItem iconStart={Link} shortcut="⌘L">Copy link</DropdownMenuItem>29      <DropdownMenuItem iconStart={Key} description="Issues a new key; the old one works for 24 hours.">Rotate key</DropdownMenuItem>30      <DropdownMenuItem iconStart={Plug} badge={{ label: "Beta", color: "info" }}>Connect Slack</DropdownMenuItem>31    </DropdownMenuGroup>32    <DropdownMenuGroup>33      <DropdownMenuItem iconStart={Trash} variant="destructive" shortcut="⇧⌘⌫">Delete agent</DropdownMenuItem>34    </DropdownMenuGroup>35  </DropdownMenuContent>36</DropdownMenu>

Installation

text
import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuTrigger } from "@dome-systems/ds-dashboard/components";
import { ChevronDownSmall } from "@dome-systems/ds-dashboard/icons";

Usage

text
<DropdownMenu>
  <DropdownMenuTrigger render={<Button iconEnd={ChevronDownSmall} />}>Actions</DropdownMenuTrigger>
  <DropdownMenuContent>
    <DropdownMenuGroup>
      <DropdownMenuItem onClick={edit}>Edit</DropdownMenuItem>
      <DropdownMenuItem onClick={duplicate}>Duplicate</DropdownMenuItem>
    </DropdownMenuGroup>
  </DropdownMenuContent>
</DropdownMenu>

Composition

The parts, and what goes inside what. A row is a DropdownMenuItem: its props make it a check item, a radio choice or a submenu. A submenu that needs more than rows, such as its own search, is written with DropdownMenuSub.

text
DropdownMenu
├── DropdownMenuTrigger
└── DropdownMenuContent
    ├── DropdownMenuGroup
    │   ├── DropdownMenuLabel
    │   └── DropdownMenuItem
    ├── DropdownMenuRadioGroup
    │   ├── DropdownMenuLabel
    │   └── DropdownMenuItem (value)
    ├── DropdownMenuSeparator
    └── DropdownMenuGroup
        ├── DropdownMenuItem (submenu)
        │   └── DropdownMenuItem
        └── DropdownMenuSub
            ├── DropdownMenuSubTrigger
            └── DropdownMenuSubContent
                └── DropdownMenuItem

Examples

Groups and labels

Rows sit in groups. A group's separator draws the line under it, and a DropdownMenuLabel names it from inside it.

1<DropdownMenu>2  <DropdownMenuTrigger render={<Button iconEnd={ChevronDownSmall} />}>Actions</DropdownMenuTrigger>3  <DropdownMenuContent>4    <DropdownMenuGroup separator>5      <DropdownMenuLabel>Agent</DropdownMenuLabel>6      <DropdownMenuItem>Edit</DropdownMenuItem>7      <DropdownMenuItem>Duplicate</DropdownMenuItem>8    </DropdownMenuGroup>9    <DropdownMenuGroup>10      <DropdownMenuLabel>Share</DropdownMenuLabel>11      <DropdownMenuItem>Copy link</DropdownMenuItem>12      <DropdownMenuItem>Copy ID</DropdownMenuItem>13    </DropdownMenuGroup>14  </DropdownMenuContent>15</DropdownMenu>

Separators

DropdownMenuSeparator draws the same line a group's separator draws, as a part of its own. A separator sits between groups, never between two rows of one.

1<DropdownMenuContent>2  <DropdownMenuGroup>3    <DropdownMenuItem iconStart={PencilSquare}>Edit</DropdownMenuItem>4    <DropdownMenuItem iconStart={Copy}>Duplicate</DropdownMenuItem>5  </DropdownMenuGroup>6  <DropdownMenuSeparator />7  <DropdownMenuGroup>8    <DropdownMenuItem iconStart={Archive}>Archive</DropdownMenuItem>9  </DropdownMenuGroup>10</DropdownMenuContent>

Icons

iconStart puts a 14px icon before the label.

1<DropdownMenuContent>2  <DropdownMenuGroup>3    <DropdownMenuItem iconStart={PencilSquare}>Edit</DropdownMenuItem>4    <DropdownMenuItem iconStart={Copy}>Duplicate</DropdownMenuItem>5    <DropdownMenuItem iconStart={Link}>Copy link</DropdownMenuItem>6  </DropdownMenuGroup>7</DropdownMenuContent>

Shortcuts

shortcut shows a row's keys at its end, in the ds Kbd. It only shows them: the page binds the keys.

1<DropdownMenuContent>2  <DropdownMenuGroup>3    <DropdownMenuItem iconStart={PencilSquare} shortcut="⌘E">Edit</DropdownMenuItem>4    <DropdownMenuItem iconStart={Copy} shortcut="⌘D">Duplicate</DropdownMenuItem>5    <DropdownMenuItem iconStart={Link} shortcut="⌘L">Copy link</DropdownMenuItem>6  </DropdownMenuGroup>7</DropdownMenuContent>

Descriptions

description adds a muted second line under the label; the row grows to hold it. Give the menu width={320} so long lines wrap at a known width.

1<DropdownMenuContent width={320}>2  <DropdownMenuGroup>3    <DropdownMenuItem iconStart={Key} description="Issues a new key; the old one keeps working for 24 hours.">4      Rotate key5    </DropdownMenuItem>6    <DropdownMenuItem iconStart={PauseCircle} description="Stops new runs. Runs in progress finish.">7      Pause agent8    </DropdownMenuItem>9  </DropdownMenuGroup>10</DropdownMenuContent>

Badges

badge ends the row with a small ds Badge (20px in an md menu, 16px in an sm one), a status such as an integration's; the row keeps its height. It takes the Badge's own shape:dot is a status dot, color picks its color, and title says more on hover.

1<DropdownMenuContent>2  <DropdownMenuGroup>3    <DropdownMenuItem iconStart={Plug} badge={{ label: "Connected", color: "success", dot: true, title: "Synced 2 minutes ago" }}>Slack</DropdownMenuItem>4    <DropdownMenuItem iconStart={Plug} badge={{ label: "Beta", color: "info" }}>Linear</DropdownMenuItem>5    <DropdownMenuItem iconStart={Plug}>Jira</DropdownMenuItem>6  </DropdownMenuGroup>7</DropdownMenuContent>

A badge after the text

badgePlacement="after" puts the badge right after the row's text, for a row whose end is taken by its check or its chevron.

1<DropdownMenuContent>2  <DropdownMenuGroup>3    <DropdownMenuItem badge={{ label: "Preview", color: "info" }} badgePlacement="after" submenu={<DropdownMenuItem>Managed</DropdownMenuItem>}>Type</DropdownMenuItem>4    <DropdownMenuItem submenu={<DropdownMenuItem>Active</DropdownMenuItem>}>Status</DropdownMenuItem>5  </DropdownMenuGroup>6</DropdownMenuContent>

A status's dot

dot draws a status's dot before the label, in the icon's place and its 14px box. It takes the Status dot's own settings; with a dot, iconStart is not drawn.

1<DropdownMenuContent>2  <DropdownMenuGroup>3    <DropdownMenuItem dot={{ color: "success" }}>Active</DropdownMenuItem>4    <DropdownMenuItem dot={{ color: "warning" }}>Suspended</DropdownMenuItem>5    <DropdownMenuItem dot={{ color: "error" }}>Revoked</DropdownMenuItem>6  </DropdownMenuGroup>7</DropdownMenuContent>

Check items

A row with checked switches on or off when clicked, and the menu stays open. indicator says how the row shows it is on: a checkbox before the label ("checkbox"), the small check at the row's end ("check", the default, the one the Select uses), or a switch ("switch", the next example). Which to keep is an open question, below.

1const [archived, setArchived] = useState(true);2const [compact, setCompact] = useState(false);3
4// A checkbox before the label.5<DropdownMenu>6  <DropdownMenuTrigger render={<Button iconEnd={ChevronDownSmall} />}>Checkbox</DropdownMenuTrigger>7  <DropdownMenuContent>8    <DropdownMenuGroup>9      <DropdownMenuLabel>View</DropdownMenuLabel>10      <DropdownMenuItem indicator="checkbox" checked={archived} onCheckedChange={setArchived}>Show archived</DropdownMenuItem>11      <DropdownMenuItem indicator="checkbox" checked={compact} onCheckedChange={setCompact}>Compact rows</DropdownMenuItem>12    </DropdownMenuGroup>13  </DropdownMenuContent>14</DropdownMenu>15
16// The check at the row's end.17<DropdownMenu>18  <DropdownMenuTrigger render={<Button iconEnd={ChevronDownSmall} />}>Check</DropdownMenuTrigger>19  <DropdownMenuContent>20    <DropdownMenuGroup>21      <DropdownMenuLabel>View</DropdownMenuLabel>22      <DropdownMenuItem indicator="check" checked={archived} onCheckedChange={setArchived}>Show archived</DropdownMenuItem>23      <DropdownMenuItem indicator="check" checked={compact} onCheckedChange={setCompact}>Compact rows</DropdownMenuItem>24    </DropdownMenuGroup>25  </DropdownMenuContent>26</DropdownMenu>

A switch

indicator="switch" shows a row's checked state as a switch at its end, for a setting the menu turns on and off. The row is the control: the switch is only drawn.

1const [violations, setViolations] = useState(false);2
3<DropdownMenuContent>4  <DropdownMenuGroup>5    <DropdownMenuItem iconStart={ShieldCheck} indicator="switch" checked={violations} onCheckedChange={setViolations}>Show violations</DropdownMenuItem>6  </DropdownMenuGroup>7</DropdownMenuContent>

Radio group

Inside a DropdownMenuRadioGroup, rows with a value are its choices; the chosen one shows the check. Hold the choice in value and onValueChange, or let the group keep it from a defaultValue. A choice leaves the menu open. Its separator draws the line under it.

1const [sort, setSort] = useState("name");2
3<DropdownMenuContent>4  <DropdownMenuRadioGroup value={sort} onValueChange={setSort} separator>5    <DropdownMenuLabel>Sort by</DropdownMenuLabel>6    <DropdownMenuItem value="name">Name</DropdownMenuItem>7    <DropdownMenuItem value="last-run">Last run</DropdownMenuItem>8    <DropdownMenuItem value="created">Created</DropdownMenuItem>9  </DropdownMenuRadioGroup>10  {/* Uncontrolled, the group keeps the choice itself. */}11  <DropdownMenuRadioGroup defaultValue="asc">12    <DropdownMenuLabel>Order</DropdownMenuLabel>13    <DropdownMenuItem value="asc">Ascending</DropdownMenuItem>14    <DropdownMenuItem value="desc">Descending</DropdownMenuItem>15  </DropdownMenuRadioGroup>16</DropdownMenuContent>

Submenu

submenu takes the rows of a menu that opens beside the row, its first row level with it; the row ends in a chevron.

1<DropdownMenuContent>2  <DropdownMenuGroup>3    <DropdownMenuItem iconStart={PencilSquare}>Edit</DropdownMenuItem>4    <DropdownMenuItem5      iconStart={Folder}6      submenu={7        <>8          <DropdownMenuItem>Production</DropdownMenuItem>9          <DropdownMenuItem>Staging</DropdownMenuItem>10        </>11      }12    >13      Move to14    </DropdownMenuItem>15  </DropdownMenuGroup>16</DropdownMenuContent>

A submenu with a search

DropdownMenuSub with search gives a submenu a field of its own that filters its own rows, for a list of 8 values or more. It is written with DropdownMenuSubTrigger and DropdownMenuSubContent.

1<DropdownMenuContent>2  <DropdownMenuGroup>3    <DropdownMenuItem iconStart={PencilSquare}>Edit</DropdownMenuItem>4    <DropdownMenuSub search={workspaces.length >= DROPDOWN_MENU_SEARCH_MIN} searchPlaceholder="Search workspaces">5      <DropdownMenuSubTrigger iconStart={Folder}>Move to</DropdownMenuSubTrigger>6      <DropdownMenuSubContent width={240} maxHeight={320}>7        <DropdownMenuGroup>8          {workspaces.map((name) => (9            <DropdownMenuItem key={name}>{name}</DropdownMenuItem>10          ))}11        </DropdownMenuGroup>12      </DropdownMenuSubContent>13    </DropdownMenuSub>14  </DropdownMenuGroup>15</DropdownMenuContent>

Destructive

variant="destructive" is for an action that deletes, revokes or removes: red text and icon.

1<DropdownMenuContent>2  <DropdownMenuGroup separator>3    <DropdownMenuItem iconStart={PencilSquare}>Edit</DropdownMenuItem>4    <DropdownMenuItem iconStart={Archive}>Archive</DropdownMenuItem>5  </DropdownMenuGroup>6  <DropdownMenuGroup>7    <DropdownMenuItem iconStart={Trash} variant="destructive">Delete agent</DropdownMenuItem>8  </DropdownMenuGroup>9</DropdownMenuContent>

Disabled

disabled dims a row that can't run now, and the pointer passes over it. The arrow keys still stop on it.

1<DropdownMenuContent>2  <DropdownMenuGroup>3    <DropdownMenuItem iconStart={PencilSquare}>Edit</DropdownMenuItem>4    <DropdownMenuItem iconStart={ShieldCheck} disabled>Transfer ownership</DropdownMenuItem>5    <DropdownMenuItem iconStart={Archive}>Archive</DropdownMenuItem>6  </DropdownMenuGroup>7</DropdownMenuContent>

End action

endAction puts a small icon button at the row's far right while the row is under the pointer or the keyboard, such as a recent item's remove. The Delete key runs it too.

1const [removed, setRemoved] = useState("nothing yet");2
3<DropdownMenuContent width={240}>4  <DropdownMenuGroup>5    <DropdownMenuLabel>Recent</DropdownMenuLabel>6    <DropdownMenuItem endAction={{ icon: Trash, label: "Remove Billing assistant", onClick: () => setRemoved("Billing assistant") }}>Billing assistant</DropdownMenuItem>7    <DropdownMenuItem endAction={{ icon: Trash, label: "Remove Support triage", onClick: () => setRemoved("Support triage") }}>Support triage</DropdownMenuItem>8  </DropdownMenuGroup>9</DropdownMenuContent>10
11<p>Removed: {removed}</p>

Running an action

A row runs its action from onClick, then the menu closes. Not onSelect: Base UI never calls it. Shown open here, the menu stays so you can try every row.

1const [ran, setRan] = useState("nothing yet");2
3<DropdownMenuContent>4  <DropdownMenuGroup>5    <DropdownMenuItem onClick={() => setRan("Edit")}>Edit</DropdownMenuItem>6    <DropdownMenuItem onClick={() => setRan("Duplicate")}>Duplicate</DropdownMenuItem>7    <DropdownMenuItem onClick={() => setRan("Copy link")}>Copy link</DropdownMenuItem>8  </DropdownMenuGroup>9</DropdownMenuContent>10
11<p>Ran: {ran}</p>

Keep the menu open

closeOnClick={false} keeps the menu open after a row runs, for rows meant to be pressed again, such as a zoom step.

1const [zoom, setZoom] = useState(100);2
3<DropdownMenuContent>4  <DropdownMenuGroup>5    <DropdownMenuLabel>Zoom {zoom}%</DropdownMenuLabel>6    <DropdownMenuItem closeOnClick={false} shortcut="⌘+" onClick={() => setZoom((z) => z + 10)}>Zoom in</DropdownMenuItem>7    <DropdownMenuItem closeOnClick={false} shortcut="⌘−" onClick={() => setZoom((z) => z - 10)}>Zoom out</DropdownMenuItem>8  </DropdownMenuGroup>9</DropdownMenuContent>

Long menus

maxHeight (160 or 320) is as tall as the menu grows; past it the rows scroll, with a thin scrollbar and a short fade at the edge, and the last row shown is cut in half, so there is visibly more.

1<DropdownMenuContent width={240} maxHeight={160}>2  <DropdownMenuGroup>3    {workspaces.map((name) => (4      <DropdownMenuItem key={name}>{name}</DropdownMenuItem>5    ))}6  </DropdownMenuGroup>7</DropdownMenuContent>

Search

search on the Dropdown menu puts a field at its top that filters the rows by their text. A menu gets one at 8 rows or more: search={rows.length >= DROPDOWN_MENU_SEARCH_MIN}.

1<DropdownMenu search={workspaces.length >= DROPDOWN_MENU_SEARCH_MIN} searchPlaceholder="Search workspaces">2  <DropdownMenuTrigger render={<Button iconEnd={ChevronDownSmall} />}>Move to</DropdownMenuTrigger>3  <DropdownMenuContent width={240} maxHeight={320}>4    <DropdownMenuGroup>5      {workspaces.map((name) => (6        <DropdownMenuItem key={name}>{name}</DropdownMenuItem>7      ))}8    </DropdownMenuGroup>9  </DropdownMenuContent>10</DropdownMenu>

Sizes

size on DropdownMenuContent: md rows are 28px at 13px, sm rows 24px at 12px. Its rows, labels and search take it, and so does a submenu.

1<DropdownMenuContent size="md">…</DropdownMenuContent>2<DropdownMenuContent size="sm">…</DropdownMenuContent>

A row's own size

A row takes its DropdownMenuContent's size; its own size overrides it, as the last row here (sm in an md menu). No menu in the dashboard does this; whether to keep it is an open question, below.

1<DropdownMenuContent size="md">2  <DropdownMenuGroup>3    <DropdownMenuItem>Edit</DropdownMenuItem>4    <DropdownMenuItem>Duplicate</DropdownMenuItem>5    <DropdownMenuItem size="sm">Copy ID</DropdownMenuItem>6  </DropdownMenuGroup>7</DropdownMenuContent>

Width

A menu fits its longest row. width fixes it: 240 for lists of names that vary in length, 320 for rows with long descriptions (see Descriptions). In a menu of fixed width a label longer than its row is cut, and what sits at the row's end (a badge, a shortcut) keeps its place.

1<DropdownMenuContent>…</DropdownMenuContent>2<DropdownMenuContent width={240}>3  <DropdownMenuItem badge={{ label: "Workspace" }}>sandbox-amber-anchor-production</DropdownMenuItem>4</DropdownMenuContent>

Placement

side is the trigger's side the menu opens on, align how it lines up along that side, and sideOffset and alignOffset nudge it, in px. When there's no room, the menu flips to the other side; collisionAvoidance says otherwise.

1<DropdownMenuContent side="right" align="start" sideOffset={8}>…</DropdownMenuContent>2<DropdownMenuContent side="top" align="end" alignOffset={-4}>…</DropdownMenuContent>

A row's menu

A table row's actions open from an icon-only button. It has no label, so it needs a name: aria-label, or a tooltip.

1<DropdownMenu>2  <DropdownMenuTrigger render={<Button emphasis="ghost" size="sm" iconStart={Dots3Horizontal} tooltip="Agent actions" />} />3  <DropdownMenuContent align="end">4    <DropdownMenuGroup separator>5      <DropdownMenuItem iconStart={PencilSquare}>Edit</DropdownMenuItem>6      <DropdownMenuItem iconStart={Cog}>Settings</DropdownMenuItem>7    </DropdownMenuGroup>8    <DropdownMenuGroup>9      <DropdownMenuItem iconStart={Trash} variant="destructive">Delete agent</DropdownMenuItem>10    </DropdownMenuGroup>11  </DropdownMenuContent>12</DropdownMenu>

Controlled

With open and onOpenChange the page decides when the menu is open, so another control can open it. defaultOpen only makes it start open. Here a second button opens it once it is closed.

1const [open, setOpen] = useState(false);2
3<Button emphasis="ghost" onClick={() => setOpen(true)}>Open it from here</Button>4<DropdownMenu open={open} onOpenChange={setOpen}>5  <DropdownMenuTrigger render={<Button iconEnd={ChevronDownSmall} />}>Actions</DropdownMenuTrigger>6  <DropdownMenuContent>…</DropdownMenuContent>7</DropdownMenu>

Non-modal

By default a menu is modal: while it's open the page doesn't scroll, and a click outside only closes it. modal={false} leaves the page live. Close it, open it again, then scroll the page.

1<DropdownMenu modal={false}>2  <DropdownMenuTrigger render={<Button iconEnd={ChevronDownSmall} />}>Actions</DropdownMenuTrigger>3  <DropdownMenuContent>…</DropdownMenuContent>4</DropdownMenu>

In a container

container renders the menu into an element instead of the page's body, and keeps it inside: here a 160px panel, so the long menu scrolls within it. Its submenus render there too.

1const [panel, setPanel] = useState<HTMLElement | null>(null);2
3// The menu mounts once the panel is there to render into.4<div ref={setPanel} className="relative h-40 w-72 rounded-[12px] p-3 shadow-[inset_0_0_0_1px_var(--color-border)]">5  {panel ? (6    <DropdownMenu>7      <DropdownMenuTrigger render={<Button iconEnd={ChevronDownSmall} />}>Move to</DropdownMenuTrigger>8      <DropdownMenuContent container={panel}>…</DropdownMenuContent>9    </DropdownMenu>10  ) : null}11</div>

API Reference

DropdownMenu

The root: it holds the menu's state. Besides these, every prop of Base UI's Menu.Root.

PropTypeDefaultDescription
openboolean—Whether the menu is open, controlled; with onOpenChange.
defaultOpenbooleanfalseStarts open. After that the menu opens and closes by itself.
onOpenChange(open, details) => void—Called when it opens or closes, with the reason.
modalbooleantrueWhile open, the page behind doesn't scroll and a click outside only closes the menu.
searchbooleanfalseA field at the menu's top that filters the rows by their text. Give it to a menu of DROPDOWN_MENU_SEARCH_MIN (8) rows or more.
searchPlaceholderstring"Search"The field's placeholder and name.
searchOptionsDropdownMenuSearchOptions—Settings for the search, passed to Base UI. Among them: the typed text (value, onValueChange), whether the first match is highlighted while typing (autoHighlight), and a custom way to match rows (filter; null keeps every row).
searchIconIconComponent | nullMagnifyingGlassThe icon in the field. Set it to null for no icon, when people type a value there instead of searching.
searchInputDropdownMenuSearchInput—What the field is told beyond its placeholder: inputMode, a key handler.
searchPlacement"start" | "end""start"Where the field sits: on the menu's top edge, or on its bottom edge under the rows, for a value typed after a choice made above it.

DropdownMenuTrigger

What opens the menu. Besides these, every prop of Base UI's Menu.Trigger.

PropTypeDefaultDescription
renderReactElement—The element it renders, usually a ds Button: render={<Button iconEnd={ChevronDownSmall} />}.
childrenReactNode—The trigger's label.

DropdownMenuContent

The menu itself, placed against its trigger. Its rows scroll inside its 4px padding. Besides these, every prop of Base UI's Menu.Popup.

PropTypeDefaultDescription
size"md" | "sm""md"md rows are 28px at 13px, sm rows 24px at 12px. Its rows, labels, search and submenus take it.
width240 | 320—A fixed width: 240 for lists of names that vary in length, 320 for rows with long descriptions. Unset, the menu fits its longest row.
maxHeight160 | 320—The tallest it grows, never past the room on screen. Past it the rows scroll under a thin thumb and a short fade, and the last one shown is cut in half.
side"bottom" | "top" | "left" | "right" | "inline-start" | "inline-end""bottom"The trigger's side it opens on.
align"start" | "center" | "end""start"How it lines up with the trigger along that side.
sideOffsetnumber4The gap to the trigger, in px.
alignOffsetnumber0A shift along the trigger, in px.
collisionAvoidanceobject—What it does when it doesn't fit beside its trigger, Base UI's own setting. By default it flips to the other side; with side and align both "none" it stays where it was asked.
containerHTMLElement | ShadowRoot | RefObject | null—Where the menu renders; the page's body by default. Its submenus render there too.

DropdownMenuGroup

A group of rows. Besides this, every prop of Base UI's Menu.Group.

PropTypeDefaultDescription
separatorbooleanfalseA line under the group, between it and the next.

DropdownMenuLabel

A group's name, in smaller, muted text. It sits inside a DropdownMenuGroup or a DropdownMenuRadioGroup: outside one, Base UI throws when the menu opens.

PropTypeDefaultDescription
childrenReactNode—The name.

DropdownMenuItem

A row. Its props make its kind: an action, a check item (checked), a radio choice (value, in a DropdownMenuRadioGroup) or a submenu (submenu). Besides these, every prop of Base UI's Menu.Item.

PropTypeDefaultDescription
childrenReactNode—The row's label.
onClick(event) => void—Runs the action. Not onSelect: Base UI never calls it. Whether the menu then closes is closeOnClick.
closeOnClickboolean—Whether a click on the row closes the menu. By default an action closes it; a check item and a radio choice leave it open.
iconStartIconComponent—A 14px icon before the label.
dotStatusDotSpec—A status's dot before the label, in the icon's place and its 14px box, with the Status dot's own settings (color, size, halo, haloSize, pulse). With a dot, iconStart is not drawn.
descriptionReactNode—A muted second line under the label; the row grows to hold it.
badgeBadgeSpec—A small ds Badge at the row's end, on its first line: a status. The Badge's own shape: label, color, emphasis, dot (a status dot), iconStart, iconEnd, title (a hover text).
badgePlacement"end" | "after""end"Where the badge sits: at the row's end, or right after the text, for a row whose end is taken by its check or its chevron.
shortcutstring—The row's keys at its end, as the ds Kbd (⌘E). It shows them; the page binds them.
endAction{ icon, label, onClick }—A small icon button at the far right while the row is highlighted. label names it. The Delete key runs it too.
variant"default" | "destructive""default"destructive: an action that deletes, revokes or removes. Red text and icon.
disabledbooleanfalseDims the row, and the pointer passes over it. The arrow keys still stop on it.
checkedboolean—A checked state: the row turns it over on a click, and the menu stays open.
onCheckedChange(checked, details) => void—Called when the row turns its state over.
indicator"check" | "checkbox" | "switch""check"How the row shows it is on: a small check at the row's end (the one the Select uses), a checkbox before the label, or a switch at the row's end.
valueunknown—Inside a DropdownMenuRadioGroup: the value this row picks.
submenuReactNode—The rows of a menu that opens beside this row, its first row level with it. The row ends in a chevron.
size"md" | "sm"—The row's size; by default its DropdownMenuContent's.

DropdownMenuRadioGroup

Rows with a value inside it are its choices; the chosen one shows the check. Besides these, every prop of Base UI's Menu.RadioGroup.

PropTypeDefaultDescription
valueunknown—The chosen value, controlled; with onValueChange.
defaultValueany—The chosen value it starts with, uncontrolled.
onValueChange(value, details) => void—Called when a row is chosen.
separatorbooleanfalseA line under the group, between it and the next.

DropdownMenuSeparator

A line across the menu, edge to edge. A separator sits between groups, never between two rows of one; a group's separator draws it for you.

DropdownMenuSub

A submenu written out in its parts, where a DropdownMenuItem's submenu is not enough: it wraps a DropdownMenuSubTrigger and a DropdownMenuSubContent. It takes the Dropdown menu's six search props (search, searchPlaceholder, searchOptions, searchIcon, searchInput, searchPlacement), for a field of its own that filters its own rows. Besides these, every prop of Base UI's Menu.SubmenuRoot.

DropdownMenuSubTrigger

The row that opens the submenu, with the chevron at its end. It takes a row's size, variant, iconStart, dot, description, badge, badgePlacement and shortcut, as a DropdownMenuItem does. It has no endAction. Besides these, every prop of Base UI's Menu.SubmenuTrigger.

DropdownMenuSubContent

The submenu itself. It takes DropdownMenuContent's props and opens to the right of its trigger, 4px away, its first row level with the trigger's: side is "right" and alignOffset is -4 unless set.

DropdownMenuRow

The inside of a row by itself, for another list that takes a menu row's look, with dropdownMenuRowClassName for the row's box. It takes what a row shows (size, iconStart, dot, description, badge, badgePlacement, shortcut, endAction), plus the two below.

PropTypeDefaultDescription
checkboxboolean—A checkbox before everything, in this state.
endReactNode—The check or the chevron, in the slot before the end action.

Keyboard

KeyDoes
Enter, SpaceOn the trigger, opens the menu on its first row; on a row, runs it.
↓On the trigger, opens the menu; in it, moves to the next row.
↑On the trigger, opens the menu on its last row; in it, moves to the previous row.
→ ←Opens a submenu, or closes it back to its row.
Home, EndMoves to the first or the last row.
A letterMoves to the next row whose label starts with it. In a menu with a search, letters go to the field.
DeleteRuns the highlighted row's end action.
EscCloses the menu; focus goes back to the trigger. In a submenu, closes the submenu alone.

Rules

Written down

A line sits between groups, never between two rows of one

A group's separator draws the line under it.

From ds/README.md (Dropdown menu).

A menu of 8 rows or more gets a search

search={rows.length >= DROPDOWN_MENU_SEARCH_MIN}. The page asks for it: the menu cannot decide alone, because the search takes focus before any row is there. A submenu with that many values gets its own.

From ds/README.md (Dropdown menu) and ds/components/dropdown-menu.tsx.

Two fixed widths, each for one kind of list

240 is for lists of names that vary in length, 320 for rows with long descriptions. Otherwise a menu is as wide as its longest row.

From ds/README.md (Dropdown menu).

Delete runs a row's end action, never Backspace

A list like this invites Backspace by accident.

From ds/README.md (Dropdown menu) and ds/components/dropdown-menu.tsx.

A shortcut is a Kbd, not free text

A row's shortcut draws the ds Kbd at its end.

From ds/README.md (Dropdown menu).

A switch is for a setting of the menu itself

Not for one of the things the menu lists.

From ds/README.md (Dropdown menu).

In a table row's menu, destructive actions come last, under a line

Safe actions first, then "Go to" links, then the destructive ones. The rule is written for a table row's menu only.

From .claude/rules/dashboard-ui.md (T6).

Open questions

Check items: the check at the end, a checkbox before the label, or both?

Open
Ours

Both, by indicator: the small check at the row's end is the default, and a checkbox before the label is the other. Nothing written says when to use which, or whether to keep both. The switch has its own rule, above.

Other systems

Not looked up.

A row's own size: keep it, or remove it?

Open
Ours

A row takes its DropdownMenuContent's size, or its own. Nothing in the dashboard sets a row's; the menu's is enough.

Other systems

Not looked up.

Catalog
Foundations
  • Overview
  • Components
  • Tokens
  • Token usage
  • Typography
  • Icons
Atoms
  • Avatar
  • Badge
  • Button
  • Checkbox
  • Color picker
  • Copy button
  • Icon tooltip
  • Inline code
  • Input
  • Hint
  • Kbd
  • Loader
  • Native select
  • Progress bar
  • Progress ring
  • Radio
  • Select
  • Status dot
  • Switch
  • Text link
  • Textarea
  • Tooltip
  • Truncate
Molecules
  • Accordion
  • Activity chart
  • AI elements
  • Alert
  • Button group
  • Card
  • Code block
  • Combobox trigger
  • Command
  • Content table
  • Context switcher
  • Dropdown menu
  • Empty state
  • Field
  • Field group
  • Filter chip
  • Flow
  • Heading
  • Icon picker
  • Icon flow card
  • Metric card
  • Modal
  • Modal confirmation
  • Pagination
  • Popover
  • Scroll area
  • Sidebar
  • Table
  • Tabs
  • Toggle group
LibraryPublished release