agents/projects/chrome-design-system/assets/component-specs/ContextMenus_Spec.md
This specification document outlines the mapping, design tokens, styling variants, and interactive states of the ContextMenus component across Figma, C++ Views, and WebUI (Web Frontend).
The ContextMenus component is a floating, dropdown list containing context-dependent action items. It supports custom list item rows, menu dividers, key action shortcuts, toggle checkbox markers, and disabled option styles.
| Feature | Figma Component | C++ Views (Desktop) | WebUI (Web Frontend) |
|---|---|---|---|
| Component Name | ContextMenus | views::MenuItemView | <cr-action-menu> |
| Source Files | Figma Link: 323:14690 | ui/views/controls/menu/menu_item_view.h | ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.ts |
| Feature / Variant | Figma Component | C++ Views (Desktop) | WebUI (Web Frontend) |
|---|---|---|---|
| Context Menu | Context Menu | Menu controller instantiation | <cr-action-menu> container |
| Menu Item | Context Menu Row | views::MenuItemView child row | <button class="menu-item"> |
| Menu Divider | Divider | views::MenuItemView::Type::kSeparator | <hr class="divider"> separator |
| Keyboard Shortcut | Ctrl+R or Ctrl+W label | MenuItemView::SetSecondaryTitle() | Text element nested inside LHS/RHS rows |
| State | Figma Component | C++ Views (Desktop) | WebUI (Web Frontend) |
|---|---|---|---|
| Default (Normal) | state=Default | Base menu item style | Default row style |
| Hovered | state=Hovered | Target row changes background color | .menu-item:hover styles |
| Pressed | state=Pressed | Handled via item trigger select | .menu-item:active actions |
| Disabled | State=Disabled / Grayed | views::MenuItemView::SetEnabled(false) | Attribute: [disabled] on button row |
| Design Attribute | Figma Design Token | C++ Views (Desktop) | WebUI (Web Frontend) |
|---|---|---|---|
| Menu Container BG | --desktop/sys/surface-colors/surface | ||
(white) | ui::kColorMenuBackground | --cr-menu-background-color | |
| Menu Text Color | --desktop/sys/surface-colors/on-surface | ||
(#1f1f1f) | ui::kColorMenuItemForeground | --cr-menu-item-text-color | |
| Disabled Text Color | --desktop/sys/state-colors/state-disabled | ||
(rgba(31,31,31,0.38)) | ui::kColorMenuItemForegroundDisabled | --cr-disabled-text-color | |
| Corner Radius | --desktop/corner-radius/12 | ||
(12px) | Resolved by native menu styles | border-radius: 8px; or 12px; | |
| Elevation Shadow | --desktop/elevation/3 | ||
| (Dual drop shadows) | Handled dynamically by native menus | Handled via custom shadow elevations | |
| Inner Side Padding | --desktop/spacing/16 | ||
(16px padding) | Matches list padding metric parameters | padding-inline-start: 16px; |
views::MenuRunner) positioned to cascade correctly beside the parent item.views::View (Base layout unit)
└── views::MenuItemView (Handles items, separators, and submenu indicators)
HTMLElement (Browser element base)
└── LitElement / CrLitElement (Web UI host)
└── CrActionMenuElement (Reusable cr-action-menu component)