Menubar
Roving application menus over package-owned native ActionMenu popovers.
All components · Theme builder · Implementation source
Live preview
Install
netscript ui:add menubarUsage and examples
The preview runs this JSX with the installed components. Import any composed primitives from your UI directory.
import { useState } from 'preact/hooks';
import { Menubar } from '@app/components/ui/menubar.tsx';
export function Example() {
const [value, setValue] = useState('standard');
const [open, setOpen] = useState(false);
const [notice, report] = useState('');
return (<><div><Menubar label="Order actions" menus={[{id:"file",label:"File",items:[{id:"save",label:"Save order",onSelect:()=>report("Saved")}]}]} /></div><p role="status">{notice}</p></>);
}Props
Generated from native deno doc --json --private over the shipped implementation. Compound component props retain their owning interface; native attributes pass through where declared.
| Owner | Prop | Type | Optional | Description |
|---|---|---|---|---|
MenubarProps | label | string | No | |
MenubarProps | menus | [object Object] | No | |
MenubarProps | value | string | null | Yes | |
MenubarProps | defaultValue | string | null | Yes | |
MenubarProps | onValueChange | (menu: string | null) => void | Yes | |
MenubarProps | class | string | Yes |
MenubarProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "class" | "onChange">Keyboard
| Key | Action |
|---|---|
ArrowLeft/ArrowRight | Navigate menu triggers |
ArrowDown | Open menu |
Escape | Close menu |
Home/End | Move to first/last enabled trigger or menu item. |
Enter/Space | Open a menu, activate actions or change caller-owned checkbox/radio state. |
ArrowRight/ArrowLeft in submenu | Open/close nested menu, respecting direction. |
Tab/Shift+Tab | Close the menu and leave through the roving trigger. |
Printable character | Find the next matching menu item. |
Tokens
Semantic contract roles: border/default, radius/input, surface/bg, surface/hover.
CSS custom properties referenced directly: --ns-bg, --ns-border, --ns-border-width, --ns-control-height-sm, --ns-control-padding-x, --ns-fg, --ns-hover, --ns-radius-control, --ns-radius-input, --ns-ring, --ns-space-1, --ns-text-small, --ns-weight-strong.
Contract and compatibility
Accessibility pattern: WAI-ARIA guidance
- Roving native application menu triggers delegate popovers and collection keys to public ActionMenu; source must hydrate in an island.
- Menu records contain app callbacks and controlled choice state. Nested menu items use private copied menu-items support, not a second public component identity.
- Trigger/content preserve runtime open/closed; disabled/hover/focus are native properties and CSS. value/null controls the open menu.
Design contract values marked planned are not implementation props. The props above describe what ships today.