MenuPanel

MenuPanel

HkMenuPanel is the detachable menu container: one div that lays its rows out in a column and owns the one layout constraint a menu list keeps getting wrong. An admin drawer nests three paddings (drawer body, sidebar panel, nav row), so a footer menu built by hand used to need per-app CSS to line its left edge up with the nav items above it. The panel owns that instead: it pads with the same inline inset as the nav rows and its rows carry the nav row's own padding, so menu rows land on the nav text edge wherever the panel is placed.

  • The Vue form is a pure shell: no drawer or popover dependency, no state, no emits. Drop it into a drawer footer, a popup body, a dropdown, or any other host as the vertical list of rows.
  • The rows are other components: MenuActionItem for an action, MenuIdentityItem for a person or workspace header, MenuSection for a captioned run.
  • For a menu that opens from a trigger and cascades, use HkMenu — it draws its own rows and does not use this panel. The Rust crate's older inline menu is Menu (legacy).

Import

tsx
1
import { HkMenuPanel } from "@celestia-island/hikari";
rust
1
2
use hikari_components::*;          // MenuPanel
use hikari_components::prelude::*; // MenuPanelProps, rsx!, VNode

The Rust form is a plain function, MenuPanel(MenuPanelProps { … }). Inside rsx! every prop may be omitted: label defaults to None (no aria-label attribute at all, matching Vue's undefined) and children to the empty vnode. Both forms ship the same stylesheet, so the class names are literal and identical: .hk-menu-list on both sides.

The shell, and what the stylesheet owns

Both forms render the same three things and nothing else: a div with the class hk-menu-list, role="menu", and the aria-label — written only when label is not nullish — around whatever rows the host passes.

Everything visible comes from the sheet:

  • the panel is a flex column with a 4px gap, so rows stack tightly without the host adding spacing;
  • its inline padding is --hk-menu-panel-inset (12px by default, 8px vertically), which is the nav sidebar body's own inset — override the token to re-anchor the panel against a different container;
  • the panel republishes --hk-menu-section-gap at its own 4px row rhythm, so a MenuSection moved into the panel matches the rows around it instead of using the section grammar's smaller default.

An empty label is kept, not dropped: Vue writes aria-label="" for "", and the Rust form does the same for Some("") — only None omits the attribute.

Rows: who offers a mirror, and who does not

The panel's own surface is identical on the two sides; the rows are not.

  • MenuIdentityItem and MenuSection have Rust mirrors in this crate, sharing these sheets, so the Rust example above uses them directly and the two previews draw the same header row and the same captioned bands.
  • MenuActionItem has no Rust mirror. In a Rust panel an action row is host markup: a button carrying the action row's classes, which is what the fence above writes. That is not a gap the panel can close — the panel only lays rows out, it never draws them.
  • The Vue row emits its click and handles its own disabled; the Rust row is whatever element the host put there, so a disabled action row there means a disabled attribute (or an omitted handler) on the host's own button.

The active / danger / disabled faces are the shared menu-item grammar's [data-active] / [data-danger] / native disabled attributes — in Rust they are the host's to stamp, which is why the fence writes them by hand.

API

Vue

Props

NameTypeDefaultRequired
labelStringundefined—

Rust

Props — MenuPanel

PropTypeDefaultDescription
labelOption<String>NoneAccessible label for the menu list (Vue: label, default undefined).
childrenElement(empty)The menu rows (Vue: the default slot — HkMenuActionItem, HkMenuIdentityItem, HkMenuSection…, in host order).

Accessibility

  • The panel is the menu surface: role="menu", named by label when one is given. An unnamed panel is an unnamed menu — pass a label ("Account menu", "Row actions") so a screen reader can tell several lists on one page apart.
  • The role comes with a keyboard contract the shell does not implement: no arrow-key navigation, no tabindex management, no aria-activedescendant. The host's rows provide whatever keyboard behaviour exists, which is why an action row should be a real button rather than a div.
  • An empty label still writes aria-label="", which names the menu with the empty string rather than leaving it unnamed — omit the prop instead of passing "" when there is nothing to say.
  • On the Rust side the shell renders exactly the same attributes, so the same three points apply; the rows are host markup there and carry their own roles.

Related components

  • MenuActionItem — the action row the panel is usually filled with.
  • MenuIdentityItem — the identity header row, mirrored in Rust.
  • MenuSection — the captioned run of rows, which picks up the panel's --hk-menu-section-gap.
  • HkMenu — the cascading, trigger-driven menu; not built on this panel.