Skip to main content
NetScriptdocs Search docs ⌘K v0.0.9
Browse documentation

Menubar

Roving application menus over package-owned native ActionMenu popovers.

All components · Theme builder · Implementation source

Live preview

Open live menubar preview

Install

Shell
netscript ui:add menubar

Usage and examples

The preview runs this JSX with the installed components. Import any composed primitives from your UI directory.

TypeScript
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.

OwnerPropTypeOptionalDescription
MenubarPropslabelstringNo
MenubarPropsmenus[object Object]No
MenubarPropsvaluestring | nullYes
MenubarPropsdefaultValuestring | nullYes
MenubarPropsonValueChange(menu: string | null) => voidYes
MenubarPropsclassstringYes
TypeScript
MenubarProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "class" | "onChange">

Keyboard

KeyAction
ArrowLeft/ArrowRightNavigate menu triggers
ArrowDownOpen menu
EscapeClose menu
Home/EndMove to first/last enabled trigger or menu item.
Enter/SpaceOpen a menu, activate actions or change caller-owned checkbox/radio state.
ArrowRight/ArrowLeft in submenuOpen/close nested menu, respecting direction.
Tab/Shift+TabClose the menu and leave through the roving trigger.
Printable characterFind 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.

Search all documentation

Type a term to search the documentation.