MenuActionItem
HkMenuActionItem is one selectable row of a menu: a <button type="button" role="menuitem"> holding an optional leading icon cell, a label and an optional trailing suffix. It renders as a bare button with no list wrapper of its own, so it works inside any menu host — a popover, a drawer footer, a hand-built menu list — and every attribute you put on it (a class, a ref, an aria-*) falls through to the button element.
- Its metrics are not its own: the row is one adopter of the library's unified menu-item grammar (row height, icon cell, hover wash, active face, danger tint, disabled dimming, inset focus ring), so a menu built from these rows lines up with the select options and the other row families around it.
- A run of rows under a small caption is MenuSection; the avatar/name row above a user menu is MenuIdentityItem. All three share one padding so a menu reads as one list.
- A navigation row that may be an <a> or an accordion group is NavItem, and a whole navigation band is NavSidebar. This row is always a button, it never links anywhere itself, and it does not build a menu — it reports the press and leaves the rest to its host.
Import
;
The component is exported as HkMenuActionItem and as the short alias HMenuActionItem. There is no Rust mirror of this row: the crate's menu code is Menu, MenuPanel and MenuItem, none of which is this component, so this page is Vue-only.
role="menuitem" goes on every row unconditionally, but the component builds no menu around it: no role="menu" container, no roving tabindex, no arrow-key handling. Those belong to the host — a menu's keyboard and screen-reader contract comes from the container, not from one row.
Icons, label and the suffix slot
icon is a leading node, not a registry name: pass a glyph element (for example iconByName("Camera"), or a lucide component you import yourself) and the row wraps it in the grammar's fixed 16px icon cell. Any glyph size therefore centres into one column, and the row's states tint it with the row's own ink — red on a danger row. The prop is typed loosely (Object) on purpose, so a host that builds on a different copy of Vue than hikari's own never hits VNode type-identity errors.
label is required and is the row's text; the stylesheet ellipsizes it rather than widening the row. suffix is a slot rendered after the label — a count, a keyboard hint, a check mark — and it is your content: the component adds no styling to it, so give it a muted ink if it should read as secondary.
States: active, danger, disabled
The row owns three state props, all visual:
- active marks the current row — the grammar's active face: a dim primary wash, a strong border, primary text and a heavier label. It is a "you are here" face for a list that picks one row; it is not a toggle and the row cannot press itself back off.
- danger tints the row for destructive actions (log out, delete). It writes both data-danger (the grammar's state hook) and the legacy hk-menu-action-item--danger class, and the hover wash turns red with it.
- disabled writes the native disabled attribute, so the row dims to 45%, ignores the press and leaves the Tab order.
With none of them the row is the resting face. On pointer hover it takes the grammar's subtle primary wash and a medium border — unless it is active, which wins over hover, or disabled, which opts out of the wash entirely. Inside a bottom sheet or a mobile modal body, the same class is registered in the sheet-context grammar, so the row widens to the touch geometry (44px minimum height, a 20px icon cell) without any media query of its own.
Interaction
A press emits one click event carrying the original MouseEvent. The component keeps no state and navigates nowhere, and a disabled row never emits because the native button swallows the press before the handler runs.
Keyboard behaviour is the button's own: Tab reaches the row (unless disabled), Enter or Space presses it, and :focus-visible draws the grammar's 2px focus ring inset by 2px so it stays inside the row's box. Menu movement keys — arrows, Home/End, typeahead — are not implemented here; a menu host that needs them has to move focus between rows itself.
Last pressed: Copy link
The row marks itself active only because the host compares the pressed label with the current one: pressing does not toggle anything on the row.
API
Vue
Props
| Name | Type | Default | Required |
|---|---|---|---|
| icon | Object | undefined | — |
| label | String | — | ✓ |
| danger | Boolean | false | — |
| disabled | Boolean | false | — |
| active | Boolean | false | — |
Emits
| Event | Payload |
|---|---|
| click | MouseEvent |
Accessibility
- The row is a real <button type="button">, so it is focusable, pressed with Enter or Space, and announced as a button. Its accessible name is the label text plus whatever the suffix slot holds — a count read after the label ("Share shift S") is normal, an aria-hidden glyph contributes nothing.
- role="menuitem" promises a menu the component does not create. Inside a role="menu" container a menuitem is expected to be reached with the arrow keys, with the container managing focus; this row leaves that to the host. Outside such a container the role is still announced, so the row reads as a menu item in a group with no menu semantics — which is why every example here puts the rows in a named role="menu" list.
- active is visual only. The row writes no aria-current, aria-selected or aria-pressed, so assistive technology cannot tell the current row from the others; when it matters, name the state in the label or mark the row from the host side.
- danger is a colour, not a word. The destructive intent reaches assistive technology only through the label, so the label has to say what happens ("Delete workspace", not "Delete").
- disabled uses the native attribute, so the row leaves the Tab order and is announced as unavailable. A disabled row is unreachable rather than an error the user can try.
- The focus ring is drawn inside the row (outline-offset: -2px), so it stays visible when the row sits flush against a panel edge.
Related components
- MenuIdentityItem — the avatar/name row above these action rows, with the same padding and no interaction of its own.
- MenuSection — the captioned role="group" run of rows this row usually lives in.
- NavItem — the navigation row, with its anchor and accordion forms, when a row has to link somewhere or expand a sub-list.
- NavSidebar — a ready-made band of navigation rows, when the list is an app sidebar rather than a popup menu.