Skip to main content
  1. Docs
  2. Components
  3. Overlays

Menu

Actions in a list, from a button: arrows move, typing jumps, Escape closes. It never traps Tab.

Import
@qeetrix/react
Status
StableSince 0.0.2
Renders
<div role="menu">Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

Import

menu.tsx
// From the package: a build keeps only what it uses.
import { Menu, MenuTrigger, MenuContent, MenuItem, MenuSeparator } from "@qeetrix/react";

// Or from its own path.
import { Menu, MenuTrigger, MenuContent, MenuItem, MenuSeparator } from "@qeetrix/react/menu";

02

Props

And every native attribute of the element it renders.

PropTypeDefaultWhat it does
Menu: open · defaultOpen · onOpenChangebooleanfalseIts open state.
MenuTrigger: renderReactElement—Your own control: an IconButton named for its object.
MenuContent: side · align · sideOffset…"bottom" · "start" · 4A submenu opens at the inline end; a context menu at the pointer.
MenuItem: icon · shortcut · description…—A leading icon; a key at the end; a second line.
MenuItem: tone"default" | "danger""default"danger for a destructive action: last, after a separator.
MenuItem: onClick · disabled…—The action; or shown but not chosen.
MenuCheckboxItem: checked · onCheckedChangeboolean—An option on or off, with a sharp check.
MenuRadioGroup: value · onValueChangestring—MenuRadioItem choices, with a 6px dot.
MenuRadioItem: closeOnClickbooleantrueCloses the menu on a choice; false where several settings change in a row.
MenuGroup · MenuGroupLabel · MenuSeparator…—Labelled groups and the rules between them.
MenuSubmenu · MenuSubmenuTrigger…—A nested menu: its trigger has a chevron that mirrors in right to left.

03

Parts

Each part carries a data-slot, for tests and placement.

data-slotElementWhat it is
menu-popup<div role="menu">The list.
menu-item<div role="menuitem">An action: data-highlighted, data-tone.
menu-item-icon<svg>Its icon.
menu-item-text<span>menu-item-label and menu-item-description.
menu-shortcut<span>Its key.
menu-checkbox-item · menu-radio-item<div>With menu-item-mark: the check or the dot.
menu-separator · menu-group-label<div>Between groups, and above one.
menu-submenu-trigger<div>With menu-submenu-icon, the chevron.

04

Name the trigger for its row

Every row's ⋯ says whose actions it opens.

row-actions.tsx
<MenuTrigger render={<IconButton icon={EllipsisIcon} aria-label={`Actions for ${member.name}`} tone="neutral" />} />
Next — MenuAccessibility