Menu and popover
Anchored lists and panels that open from a button: action menus for row actions, disclosure lists for the language and account links, and popovers for help and details.
When to use
- Action menu: commands on one object that do not fit as buttons, such as a table row's "More actions for {name}" (canonical §10.13) or an overflow "More". It follows the APG menu button pattern.
- Disclosure list: a short list of links or choices that are navigation or settings rather than commands: the three-language switcher, account links (D-CSN-23, canonical §10.28).
- Popover: a short, non-modal panel of help or details next to the control it explains, with a title and a sentence or three (D-CSN-23).
When not to use
- Choosing a value inside a form: a native select or radio rows (select.md, checkbox-radio-switch.md). There is no custom listbox in 1.0 (canonical §10.4).
- Two languages: one direct link or button to the other language (language-switcher.md).
- The main action of a view: a filled button on the page, never an item in a menu (canonical §0.3).
- Site or app navigation: the site header, the navigation bar, rail, or drawer; on phones the side sheet.
- The name of an icon button: a tooltip.
- A decision, a form, or more than a few sentences: a dialog or a page.
Anatomy
Menu:
- Trigger: an icon button (more_vert, the translate icon) or a button, with
[aria-expanded]and[aria-controls]; an action menu adds[aria-haspopup="menu"]. - Container (
.oa-menu):surface-raised,rounded-box(16px),shadow-elevation-3, a transparent 1px edge, 8px above and below the rows, 200 to 320px wide, on the dropdown layer. - Item (
.oa-menu__item): a<button>or a link, at least 48px tall, 16px inline padding, 12px between its parts,body-lginon-surface.- Leading icon (
.oa-menu__icon, optional): 20px,on-surface-variant. - Label (
.oa-menu__label): wraps; never truncated. - Check (
.oa-menu__check): a 20px check inprimary-inkat the inline end, shown on the current item ([aria-current="true"]) or a checked one ([aria-checked="true"]).
- Leading icon (
- Divider (
.oa-menu__divider): a 1px--color-outline-variantline with 8px above and below. - Anchor (
.oa-menu__anchor): the element around the trigger and the menu that places it when no library does.
Popover:
- Trigger: an icon button (the help icon) or a button, with
[aria-expanded]and[aria-controls]. - Container (
.oa-popover): the menu container with 16px padding, 200 to 320px wide. - Title (
.oa-popover__title):label-md,on-surface(D-ARC-20). - Body (
.oa-popover__body):body-md,on-surface-variant. - Close button (
.oa-popover__close, optional): a 48px icon button 4px from the top and the inline end, so its icon meets the padding. - Anchor (
.oa-popover__anchor).
Variants
| Variant | Use for | Key classes and attributes |
|---|---|---|
| Action menu | Row actions, "More" | [role="menu"] on .oa-menu, [role="menuitem"] items, leading icons, dividers |
| Checkable action menu | A choice applied at once from an action menu | menuitemradio or menuitemcheckbox items with [aria-checked]; the check shows on the checked ones (D-CSN-23) |
| Disclosure list | The language switcher, account links | a <ul class="oa-menu"> of buttons or links in the Tab order; [aria-current="true"] and the check on the current one; no menu role |
| Opening upward | A trigger near the bottom of the window; the footer's language list | [data-side="top"] on the menu |
| Start-aligned | A trigger at the inline start of its row | [data-align="start"] on the menu |
| Popover | Help and details | .oa-popover with a title, a body, and an optional close button |
Sizes
| Part | Size | Token |
|---|---|---|
| Container width | 200px to 320px, as wide as its longest row, and never wider than the page frame: min(320px, 100vw - 32px), 288px in a 320px window |
--size-menu-min, --container-menu, --space-gutter (min-w-50 max-w-[min(var(--container-menu),calc(100vw-2*var(--space-gutter)))]) (D-ARC-24) |
| Container padding | 8px above and below; rows run edge to edge | --space-2 |
| Item | at least 48px tall, 16px inline padding, no block padding, 12px gaps | --size-menu-item, --space-row-inset, --space-3 |
| Icons and check | 20px; the menu sets it whatever icon class they carry | --size-icon-md (D-ARC-22) |
| Divider | 1px with 8px above and below | --space-2 |
| Distance to the trigger | 4px | --space-1 |
| Popover | 200px to 320px wide (at most the page frame, as the menu), 16px padding, 8px between title and body | --space-4, --space-stack-tight |
Tokens
| Part | Property | Token (CSS · Tailwind) |
|---|---|---|
| Container | background, text | --color-surface-raised · bg-surface-raised; --color-on-surface · text-on-surface |
| Container | corners, shadow, edge | --radius-box · rounded-box; --shadow-elevation-3 · shadow-elevation-3; 1px transparent |
| Container | layer | --z-dropdown · z-40 |
| Item | type | --text-body-lg · text-body-lg |
| Item | hover, pressed layers | --opacity-state-hover (8%), --opacity-state-pressed (12%) of currentColor |
| Item | disabled | --color-on-surface at --opacity-state-disabled-content (38%) · text-on-surface/38 |
| Item | focus ring offset | --size-focus-inset · focus-visible:-outline-offset-4 |
| Leading icon | color | --color-on-surface-variant · text-on-surface-variant |
| Check | color | --color-primary-ink · text-primary-ink |
| Divider | color | --color-outline-variant · border-outline-variant |
| Popover title, body | type, color | --text-label-md, --color-on-surface; --text-body-md, --color-on-surface-variant |
| Motion | enter, exit | fade and rise 4px over --duration-short-3 with --ease-emphasized; fade out with --ease-emphasized-accelerate |
States
| State | What changes |
|---|---|
| Enabled | on-surface label, on-surface-variant icon, no layer. |
| Hover (mouse only) | An 8% layer of the label color over the row, fading in over duration-short-3. |
| Focus-visible | The 3px ring drawn inside the row (--size-focus-inset), because the container clips. |
| Pressed | A 12% layer, shown at once; it fades on release. |
| Current or checked | The primary-ink check at the inline end; [aria-current="true"] in a disclosure list, [aria-checked="true"] in a checkable action menu. The check is the cue, not a color (D-CAI-14). |
| Disabled | Label, icon, and check in on-surface at 38%; no layer. Disclosure lists use the native [disabled] attribute; action menus use [aria-disabled="true"], which keeps the item focusable (APG). Global ID's language list disables its rows while a choice is being saved. |
| Opening, closing | Opacity and a 4px rise over duration-short-3 with ease-emphasized; closing fades over duration-short-3 with ease-emphasized-accelerate (D-SEM-16). |
Behavior
Disclosure list (Global ID's language switcher):
- The button toggles
[aria-expanded]; the list shows when its[hidden]attribute goes. Its rows are buttons or links in the normal Tab order. - Escape closes and returns focus to the button. A press outside, and focus leaving the list, close it. Choosing closes it and returns focus to the button (D-CSN-23).
Action menu (APG menu button):
- Enter, Space, or Arrow Down open it and focus the first item; Arrow Up opens it on the last item.
- Arrow Down and Arrow Up move between items and wrap; Home and End go to the first and last; typing a letter moves to the next item that starts with it. Items keep
tabindex="-1"; the script moves focus. - Enter or Space runs the item and closes the menu; focus returns to the button unless the item opens something else (a confirm dialog, which returns focus to the button when it closes).
- Escape closes and returns focus to the button; Tab closes and moves on; a press outside closes.
Placement (D-CSN-23):
- Under the trigger, aligned to its inline end, 4px apart.
- Near the bottom of the window, when the space below is shorter than the menu and the space above is taller, it opens above:
[data-side="top"]. The footer's language list always opens upward (canonical §10.16). - A trigger at the inline start of its row aligns the menu to its start:
[data-align="start"]. - Without a library,
.oa-menu__anchorplaces it with CSS. Radix sets[data-side]and[data-align]itself (side="bottom" align="end" sideOffset={4}) and flips on collision. - Inside a scrolling region (a data table's region) an absolute menu would be clipped: render it in the top layer with the
[popover]attribute and place it with the script, or use Radix, which renders it in a portal.
Popover:
- Opens on press; focus moves into it (its first control, or the panel itself with
tabindex="-1"). It is non-modal: Tab moves through it and on. - Closes on Escape (focus back to the trigger), a press outside, and its close button (D-CSN-23).
- Below 640px the same content opens as a bottom sheet, with the scrim and the modal rules.
Motion: under reduced motion base.css switches every transition off; menus and popovers appear and leave at once (D-SEM-21).
The keyboard contract of an action menu, framework-free:
const items = [...menu.querySelectorAll('[role^="menuitem"]')]; // aria-disabled items stay focusable
const label = (item) => (item.querySelector('.oa-menu__label') ?? item).textContent.trim().toLowerCase();
const hide = () => { menu.hidden = true; button.setAttribute('aria-expanded', 'false'); };
const close = () => { hide(); button.focus(); };
function open(last) {
menu.hidden = false;
button.setAttribute('aria-expanded', 'true');
(last ? items.at(-1) : items[0]).focus();
}
button.addEventListener('click', () => (menu.hidden ? open(false) : close()));
button.addEventListener('keydown', (event) => {
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); open(event.key === 'ArrowUp'); }
});
menu.addEventListener('keydown', (event) => {
const i = items.indexOf(document.activeElement);
const move = { ArrowDown: i + 1, ArrowUp: i - 1, Home: 0, End: items.length - 1 }[event.key];
if (move !== undefined) { event.preventDefault(); items.at(move % items.length).focus(); }
else if (event.key === 'Escape') close();
else if (event.key.length === 1 && event.key !== ' ') { // type-ahead on the label, never the icon's ligature
const next = [...items.slice(i + 1), ...items.slice(0, i + 1)]
.find((item) => label(item).startsWith(event.key.toLowerCase()));
next?.focus();
}
});
items.forEach((item) => item.addEventListener('click', () => {
if (item.getAttribute('aria-disabled') !== 'true') close(); // then run the action
}));
menu.addEventListener('focusout', (event) => { // Tab moves on; a press on the button is the button's to handle
const to = event.relatedTarget;
if (to && to !== button && !menu.contains(to)) hide();
});
document.addEventListener('pointerdown', (event) => {
if (!menu.hidden && !menu.contains(event.target) && !button.contains(event.target)) hide();
});Accessibility
- Disclosure lists are a button and a list, not an ARIA menu: a menu role promises arrow keys and type-ahead that three choices do not need (D-CSN-23). The button has
[aria-expanded]and[aria-controls]; the current row has[aria-current="true"]; endonyms carry theirlang. - Action menus: the button has
[aria-haspopup="menu"],[aria-expanded], and[aria-controls]; the list has[role="menu"]and is named by its button ([aria-labelledby]); items are[role="menuitem"](ormenuitemradio,menuitemcheckboxwith[aria-checked]); an<hr>divider is a separator. - Names: an icon trigger is named for what it opens, starting with its visible or implied label: "More actions for Rania Haddad" (canonical §10.13), "Language: English" (canonical §10.28), "Get help". The tooltip repeats the name (tooltip.md).
- Popover: a non-modal
[role="dialog"]named by its title through[aria-labelledby]. - Targets: rows at least 48px tall; triggers 48 × 48px (D-LAY-12).
- Contrast on
surface-raised:on-surface17.12:1 light and 11.10:1 dark;on-surface-variant9.33:1 and 8.42:1; theprimary-inkcheck 7.13:1 and 8.41:1 (Tamakkan 7.10:1 and 8.40:1) (tokens/contrast.md). - Focus: the ring sits inside the row; it never animates (canonical §6.3).
- Forced colors: the container keeps its 1px edge; the check marks the current row.
RTL and languages
- The menu aligns to the trigger's inline end, which is its left edge in Arabic; leading icons sit at the inline start (the right) and the check at the inline end (the left). overlay.css uses logical properties only (D-BCP-30).
- Arrow Up and Arrow Down do not change with the direction. Glyphs such as more_vert, check, print, and close never mirror (canonical §8.3).
- Arabic rows take
body-lgat line height 1.75: one 28px line still centers in the 48px row, so a list that mixes scripts keeps one row height. A label that wraps grows its row; never fix the height (D-TYP-14). - Language names are endonyms in their own scripts, each with
lang: "English", "العربية", "Français". - French runs about 26% longer overall and up to 32% for short labels: labels wrap inside the 320px menu and never truncate (D-TYP-15).
Content
- Action items: verb first, sentence case, no full stop: "Print ID card", "Add an email and send the invitation", "Suspend", "Restore access" (Global ID).
- Destructive items look like the others; the confirm dialog that follows carries the red button (canonical §10.1:
.oa-btn--dangeris only the confirm of a destructive dialog). - Disclosure items: what they lead to, never "Click here". Languages by their endonyms.
- Trigger names: "More actions for {name}"; "Language: {language}" / "اللغة: {language}" / "Langue : {language}".
- Popover: a short title ("Get help") and one to three sentences. Global ID's help in three languages:
| English | Arabic | French | |
|---|---|---|---|
| Title | "Get help" | "الحصول على مساعدة" (native review) | "Obtenir de l’aide" |
| Body | "The ID office can help with your ID, with signing in, and with your details. You’ll find them at Global University, Beirut." | "يستطيع مكتب الهوية والوصول مساعدتك في هويتك وتسجيل الدخول وبياناتك. ستجده في الجامعة العالمية، بيروت." | "Le Bureau de l’identité et des accès peut vous aider pour votre ID, votre connexion et vos informations. Vous le trouverez à Global University, Beyrouth." |
Do and don't
- Do use a disclosure list for three languages. Don't give it
[role="menu"]and then ignore the arrow keys. - Do keep the check as the sign of the current item. Don't mark it with color alone or with bold text alone.
- Do let long labels wrap within 320px. Don't truncate a French or Arabic label.
- Do place the menu at the trigger's inline end and flip it above near the bottom. Don't let it run off the window or under the footer.
- Do keep the popover short and non-modal. Don't put a form in a popover; use a dialog.
Code
HTML (reference CSS)
The snippet's examples (reference/snippets/overlays.html). Documentation shows the menus open with the .oa-menu__anchor--demo and .oa-popover__anchor--demo modifiers, which lay the trigger and the open list out in the page flow; in a product, drop the modifier (the anchor then places the list with CSS) and toggle the list's [hidden] attribute from the script.
Disclosure list (Global ID's language switcher). The shipped switcher is .oa-lang (language-switcher.md), and its list composes these classes: class="oa-lang__list oa-menu" on the list and class="oa-lang__option oa-menu__item" on each option, with .oa-menu__label and .oa-menu__check inside, so the two lists cannot drift. Write .oa-menu alone for the other disclosure lists, such as account links:
<div class="oa-menu__anchor oa-menu__anchor--demo">
<button class="oa-icon-btn" type="button" aria-label="Language: English" aria-expanded="true" aria-controls="ov-lang-list">
<span class="oa-icon" aria-hidden="true" translate="no">translate</span>
</button>
<ul class="oa-menu" id="ov-lang-list">
<li>
<button class="oa-menu__item" type="button" lang="en" aria-current="true">
<span class="oa-menu__label">English</span>
<span class="oa-icon oa-icon--md oa-menu__check" aria-hidden="true" translate="no">check</span>
</button>
</li>
<li>
<button class="oa-menu__item" type="button" lang="ar">
<span class="oa-menu__label">العربية</span>
<span class="oa-icon oa-icon--md oa-menu__check" aria-hidden="true" translate="no">check</span>
</button>
</li>
<li>
<button class="oa-menu__item" type="button" lang="fr">
<span class="oa-menu__label">Français</span>
<span class="oa-icon oa-icon--md oa-menu__check" aria-hidden="true" translate="no">check</span>
</button>
</li>
</ul>
</div>Action menu (row actions):
<div class="oa-menu__anchor oa-menu__anchor--demo">
<button class="oa-icon-btn" type="button" id="ov-row-more" aria-label="More actions for Rania Haddad" aria-haspopup="menu" aria-expanded="true" aria-controls="ov-row-menu">
<span class="oa-icon" aria-hidden="true" translate="no">more_vert</span>
</button>
<div class="oa-menu" role="menu" id="ov-row-menu" aria-labelledby="ov-row-more">
<button class="oa-menu__item" type="button" role="menuitem" tabindex="-1">
<span class="oa-icon oa-icon--md oa-menu__icon" aria-hidden="true" translate="no">print</span>
<span class="oa-menu__label">Print ID card</span>
</button>
<button class="oa-menu__item" type="button" role="menuitem" tabindex="-1">
<span class="oa-icon oa-icon--md oa-menu__icon" aria-hidden="true" translate="no">mail</span>
<span class="oa-menu__label">Add an email and send the invitation</span>
</button>
<hr class="oa-menu__divider">
<button class="oa-menu__item" type="button" role="menuitem" tabindex="-1">
<span class="oa-icon oa-icon--md oa-menu__icon" aria-hidden="true" translate="no">block</span>
<span class="oa-menu__label">Suspend</span>
</button>
</div>
</div>Item states (hover and pressed forced with --oa-state, focus with [data-demo-focus]; never ship those):
<ul class="oa-menu" aria-label="Language">
<li>
<button class="oa-menu__item" type="button" lang="en" aria-current="true">
<span class="oa-menu__label">English</span>
<span class="oa-icon oa-icon--md oa-menu__check" aria-hidden="true" translate="no">check</span>
</button>
</li>
<li>
<button class="oa-menu__item" type="button" lang="ar" style="--oa-state: var(--opacity-state-hover)">
<span class="oa-menu__label">العربية</span>
<span class="oa-icon oa-icon--md oa-menu__check" aria-hidden="true" translate="no">check</span>
</button>
</li>
<li>
<button class="oa-menu__item" type="button" lang="fr" data-demo-focus>
<span class="oa-menu__label">Français</span>
<span class="oa-icon oa-icon--md oa-menu__check" aria-hidden="true" translate="no">check</span>
</button>
</li>
</ul>
<ul class="oa-menu" aria-label="Language">
<li>
<button class="oa-menu__item" type="button" lang="en" aria-current="true" disabled>
<span class="oa-menu__label">English</span>
<span class="oa-icon oa-icon--md oa-menu__check" aria-hidden="true" translate="no">check</span>
</button>
</li>
<li>
<button class="oa-menu__item" type="button" lang="ar" disabled>
<span class="oa-menu__label">العربية</span>
<span class="oa-icon oa-icon--md oa-menu__check" aria-hidden="true" translate="no">check</span>
</button>
</li>
<li>
<button class="oa-menu__item" type="button" lang="fr" disabled>
<span class="oa-menu__label">Français</span>
<span class="oa-icon oa-icon--md oa-menu__check" aria-hidden="true" translate="no">check</span>
</button>
</li>
</ul>
<div class="oa-menu" role="menu" aria-label="Actions for Rania Haddad">
<button class="oa-menu__item" type="button" role="menuitem" tabindex="-1" style="--oa-state: var(--opacity-state-pressed)">
<span class="oa-icon oa-icon--md oa-menu__icon" aria-hidden="true" translate="no">print</span>
<span class="oa-menu__label">Print ID card</span>
</button>
<button class="oa-menu__item" type="button" role="menuitem" tabindex="-1" aria-disabled="true">
<span class="oa-icon oa-icon--md oa-menu__icon" aria-hidden="true" translate="no">lock_open</span>
<span class="oa-menu__label">Restore access</span>
</button>
<hr class="oa-menu__divider">
<button class="oa-menu__item" type="button" role="menuitem" tabindex="-1">
<span class="oa-icon oa-icon--md oa-menu__icon" aria-hidden="true" translate="no">block</span>
<span class="oa-menu__label">Suspend</span>
</button>
</div>Opening upward:
<div class="oa-menu__anchor oa-menu__anchor--demo">
<button class="oa-icon-btn" type="button" aria-label="Language: English" aria-expanded="true" aria-controls="ov-lang-up">
<span class="oa-icon" aria-hidden="true" translate="no">translate</span>
</button>
<ul class="oa-menu" id="ov-lang-up" data-side="top">
<li>
<button class="oa-menu__item" type="button" lang="en" aria-current="true">
<span class="oa-menu__label">English</span>
<span class="oa-icon oa-icon--md oa-menu__check" aria-hidden="true" translate="no">check</span>
</button>
</li>
<li>
<button class="oa-menu__item" type="button" lang="ar">
<span class="oa-menu__label">العربية</span>
<span class="oa-icon oa-icon--md oa-menu__check" aria-hidden="true" translate="no">check</span>
</button>
</li>
<li>
<button class="oa-menu__item" type="button" lang="fr">
<span class="oa-menu__label">Français</span>
<span class="oa-icon oa-icon--md oa-menu__check" aria-hidden="true" translate="no">check</span>
</button>
</li>
</ul>
</div>Arabic, on a page with <html lang="ar" dir="rtl">:
<div class="oa-menu__anchor oa-menu__anchor--demo">
<button class="oa-icon-btn" type="button" aria-label="اللغة: العربية" aria-expanded="true" aria-controls="ov-lang-ar">
<span class="oa-icon" aria-hidden="true" translate="no">translate</span>
</button>
<ul class="oa-menu" id="ov-lang-ar">
<li>
<button class="oa-menu__item" type="button" lang="en">
<span class="oa-menu__label">English</span>
<span class="oa-icon oa-icon--md oa-menu__check" aria-hidden="true" translate="no">check</span>
</button>
</li>
<li>
<button class="oa-menu__item" type="button" lang="ar" aria-current="true">
<span class="oa-menu__label">العربية</span>
<span class="oa-icon oa-icon--md oa-menu__check" aria-hidden="true" translate="no">check</span>
</button>
</li>
<li>
<button class="oa-menu__item" type="button" lang="fr">
<span class="oa-menu__label">Français</span>
<span class="oa-icon oa-icon--md oa-menu__check" aria-hidden="true" translate="no">check</span>
</button>
</li>
</ul>
</div>Popover:
<div class="oa-popover__anchor oa-popover__anchor--demo">
<button class="oa-icon-btn" type="button" aria-label="Get help" aria-expanded="true" aria-controls="ov-help">
<span class="oa-icon" aria-hidden="true" translate="no">help</span>
</button>
<div class="oa-popover" role="dialog" id="ov-help" aria-labelledby="ov-help-title">
<h2 class="oa-popover__title" id="ov-help-title">Get help</h2>
<p class="oa-popover__body">The ID office can help with your ID, with signing in, and with your details. You’ll find them at Global University, Beirut.</p>
<button class="oa-icon-btn oa-popover__close" type="button" aria-label="Close">
<span class="oa-icon" aria-hidden="true" translate="no">close</span>
</button>
</div>
</div>Popover in Arabic:
<div class="oa-popover__anchor oa-popover__anchor--demo">
<button class="oa-icon-btn" type="button" aria-label="الحصول على مساعدة" aria-expanded="true" aria-controls="ov-help-ar">
<span class="oa-icon" aria-hidden="true" translate="no">help</span>
</button>
<div class="oa-popover" role="dialog" id="ov-help-ar" aria-labelledby="ov-help-ar-title">
<h2 class="oa-popover__title" id="ov-help-ar-title">الحصول على مساعدة</h2>
<p class="oa-popover__body">يستطيع مكتب الهوية والوصول مساعدتك في هويتك وتسجيل الدخول وبياناتك. ستجده في الجامعة العالمية، بيروت.</p>
<button class="oa-icon-btn oa-popover__close" type="button" aria-label="إغلاق">
<span class="oa-icon" aria-hidden="true" translate="no">close</span>
</button>
</div>
</div>Tailwind CSS v4
<div class="relative inline-flex align-middle">
<!-- the trigger: an icon button with aria-haspopup, aria-expanded, and aria-controls -->
<div role="menu" class="absolute top-full end-0 mt-1 z-40 w-max min-w-50 max-w-menu overflow-y-auto overscroll-contain rounded-box border border-transparent bg-surface-raised py-2 text-on-surface shadow-elevation-3 transition-[opacity,translate] duration-short-3 ease-emphasized starting:translate-y-1 starting:opacity-0">
<button type="button" role="menuitem" tabindex="-1" class="relative isolate flex min-h-12 w-full items-center gap-3 px-row-inset text-start text-body-lg text-on-surface before:absolute before:inset-0 before:-z-1 before:bg-current before:opacity-0 before:transition-opacity before:duration-short-3 before:ease-standard hover:before:opacity-(--opacity-state-hover) active:before:opacity-(--opacity-state-pressed) active:before:duration-0 focus-visible:-outline-offset-4 disabled:text-on-surface/38 disabled:before:opacity-0 aria-disabled:text-on-surface/38 aria-disabled:before:opacity-0">
<span class="size-5 shrink-0 text-on-surface-variant" aria-hidden="true"><!-- icon --></span>
Print ID card
</button>
<hr class="my-2 border-0 border-t border-outline-variant">
</div>
</div>- Opening upward:
data-[side=top]:top-auto data-[side=top]:bottom-full data-[side=top]:mt-0 data-[side=top]:mb-1. The check:ms-auto text-primary-inkon the current row's icon. - Radix DropdownMenu: drop the placement classes (Radix places its wrapper); keep the container and item classes. Leave Radix's
[data-highlighted]unstyled: it follows keyboard focus as well as the pointer, and focus shows as the ring, never as a layer (D-ARC-02);:hoverstill draws the 8% layer. shadcn/ui: edit DropdownMenu and Popover content torounded-box bg-surface-raised shadow-elevation-3(canonical §2.12). - Popover:
relative z-40 flex w-max min-w-50 max-w-menu flex-col gap-stack-tight rounded-box border border-transparent bg-surface-raised p-4 text-on-surface shadow-elevation-3 transition-[opacity,translate] duration-short-3 ease-emphasized starting:translate-y-1 starting:opacity-0; its titletext-label-md text-on-surface pe-10, its bodytext-body-md text-on-surface-variant, its close buttonabsolute top-1 end-1.
React
Disclosure list: Global ID's LanguageMenu (src/components/shell/language-menu.tsx), a button and a list of buttons with a dismiss hook (Escape, a press outside, focus leaving).
| Prop | Type | Default | Description |
|---|---|---|---|
label |
string |
required | The button's name, "Language: English". |
current |
'en' | 'ar' | 'fr' |
required | The current language: its row gets [aria-current="true"] and the check. |
options |
{ code, name }[] |
required | Endonyms in their own scripts, in the order English, Arabic, French. |
failedMessage |
string |
required | The snackbar text when the choice cannot be saved: "We couldn’t change the language. Try again." |
opens |
'down' | 'up' |
'down' |
'up' for the footer: renders [data-side="top"]. |
Action menu: Radix DropdownMenu with the recipe above.
<DropdownMenu.Root>
<DropdownMenu.Trigger asChild>
<IconButton icon="more_vert" label={t('admin.people.moreActions', { name })} /> {/* a new message: “More actions for {name}” */}
</DropdownMenu.Trigger>
<DropdownMenu.Portal>
<DropdownMenu.Content side="bottom" align="end" sideOffset={4} collisionPadding={16} className={menuClasses}>
<DropdownMenu.Item className={itemClasses} onSelect={printCard}>
<Icon name="print" size={20} /> {t('admin.person.header.printCard')}
</DropdownMenu.Item>
<DropdownMenu.Separator className="my-2 border-t border-outline-variant" />
<DropdownMenu.Item className={itemClasses} onSelect={confirmSuspend}>
<Icon name="block" size={20} /> {t('admin.person.header.suspend')}
</DropdownMenu.Item>
</DropdownMenu.Content>
</DropdownMenu.Portal>
</DropdownMenu.Root>Popover: Radix Popover (side="bottom" align="end" sideOffset={4}) from 640px, and the same content in Global ID's BottomSheet below 640px; its title is a label-md heading and the content takes [aria-labelledby].