Menu
@xui/menuA list of commands, opened from a trigger. Built on the Angular CDK's menu primitives, so arrow-key navigation, typeahead, submenu aim, Escape and close-on-select all work — none of which jsdom exercises, so these stories are the real check.
Install
pnpm add @xui/menu Add the barrel to a standalone component's imports:
import { XuiMenuImports } from '@xui/menu';@Component({ imports: [XuiMenuImports], // …})Examples
Default
Loading preview…
<button xuiButton [xuiMenuTriggerFor]="menu">File actions</button><ng-template #menu> <xui-menu> <button xuiMenuItem icon="matDriveFileRenameOutlineRound">Rename<span menuItemLabel>⌘R</span></button> <button xuiMenuItem icon="matContentCopyRound">Duplicate<span menuItemLabel>⌘D</span></button> <xui-menu-divider /> <button xuiMenuItem icon="matDeleteRound" color="error">Delete<span menuItemLabel>⌫</span></button> </xui-menu></ng-template>Selection
Loading preview…
<button xuiButton [xuiMenuTriggerFor]="menu">View</button><ng-template #menu> <xui-menu> <xui-menu-divider title="Layout" /> <button xuiMenuItem selected>Grid</button> <button xuiMenuItem>List</button> <xui-menu-divider title="Sort" /> <button xuiMenuItem>Name</button> <button xuiMenuItem selected>Modified</button> </xui-menu></ng-template>Submenu
Disabled
Loading preview…
<button xuiButton [xuiMenuTriggerFor]="menu">Edit</button><ng-template #menu> <xui-menu> <button xuiMenuItem>Undo</button> <button xuiMenuItem disabled>Redo</button> <button xuiMenuItem disabled>Paste</button> </xui-menu></ng-template>API
A rule between groups of menu items, with an optional heading.
Inputs
classClassValueThe user-defined classes. Merged last so they win over the base classes.''titlestring | nullTurns the rule into a labelled section header.nullA command in a menu.
Variants
colornoneInputs
classClassValueThe user-defined classes. Merged last so they win over the variant classes.''iconstringName of a registered @ng-icons icon, shown in the left cell.selectedbooleanDraws a checkmark in the left cell — for a chosen option in a menu.falsecolorXuiMenuItemColorIntent colour of the item, for marking a destructive or otherwise notable action.this.config.itemColorOpens a menu from the element it sits on.
A list of commands, opened from a trigger.
Inputs
classClassValueThe user-defined classes. Merged last so they win over the base classes.''