Menubar

A desktop-style bar of menus built from the menu family: one Tab stop, arrow keys between the menus and into their neighbours, and hover switching once a menu is open.

Available in
  • Angular: available
  • Vue: available
  • React: available
  • React Native: not available yet

Usage

Import

ts
import {
  SoneMenubarDirective,
  SoneMenubarTriggerDirective,
} from "@surface-one/angular/menubar";

API reference

SoneMenubarDirectiveDirective

`[soneMenubar]` — a horizontal bar of menus (spartan/ui Menubar, WAI-ARIA menubar pattern): `role="menubar"`, one Tab stop (roving tabindex) over its `soneMenubarTrigger`s, ArrowLeft / ArrowRight, Home and End between them. Name it with `aria-label`.

Selector
[soneMenubar]
Export as
soneMenubar

SoneMenubarTriggerDirectiveDirective

`[soneMenubarTrigger]` — a top-level item of a `soneMenubar` (`role="menuitem"`, `aria-haspopup="menu"`, `aria-expanded`) that opens a `[soneMenu]` — the menu family's panel, items, submenus and keys. Enter, Space and ArrowDown open it on the first item, ArrowUp on the last; inside it ArrowLeft / ArrowRight close it and open the neighbouring menu; once a menu is open, hovering another trigger switches to it.

Selector
[soneMenubarTrigger]
Export as
soneMenubarTrigger
Inputs
NameType Default
side

The side of the trigger the panel opens on; it flips when that side lacks room.

FloatingSide"bottom"
align

Alignment along the trigger's edge.

FloatingAlign"start"
offset

Gap between the trigger and the panel, in px.

number4
opentwo-way

Shown or not — `[(open)]`.

booleanfalse
keepOpenOnOutsideClick

Keep the panel open on a click outside it (Escape still closes it).

booleanfalse
soneMenuTriggerSoneOverlayContent | nullnull
soneMenubarTriggerSoneOverlayContent | nullnull