# Menubar primitive
Source: https://texuli.com/primitives-page/menubar/
# Menubar
A horizontal bar of menus, as in a desktop application.
Import
`import * as Menubar from '@texuli/primitives/menubar';`
Pattern
[Menubar (WAI-ARIA APG)](https://www.w3.org/WAI/ARIA/apg/patterns/menubar/)
Size budget
22.0 KiB gzip for @texuli/primitives/menubar
Reference
`packages/primitives/docs/prim-menubar.md`
## Live demo
Right to left
Loading the Menubar demo…
## Anatomy
Menubar anatomy: each box holds the parts inside it.
- `Menubar.Root``Menubar.Menu``Menubar.Trigger`
- `Menubar.Portal``Menubar.Content``Menubar.Item`
- `Menubar.CheckboxItem`
- `Menubar.RadioGroup``Menubar.RadioItem`
- `Menubar.Separator`
- `Menubar.Sub``Menubar.SubTrigger`
- `Menubar.SubContent`
## Behavior checks
`tests/behavior/scenarios/menubar.spec.ts` runs **12 rows** against the Menubar scenario on Chromium, WebKit and the Pixel 7. Each row asserts what a user or assistive technology can observe, held to the WAI-ARIA Authoring Practices pattern.
All 12 rows
- a named menubar of menuitems that open menus, collapsed
- the menubar is one Tab stop: Tab leaves it from any trigger
- ArrowRight and ArrowLeft move between triggers, skipping the disabled one
- Enter on a trigger opens its menu on the first item
- in an open menu, ArrowRight and ArrowLeft open the next and previous menus
- ArrowRight on a submenu trigger opens the submenu; ArrowLeft closes it
- Escape closes the menu and returns focus to its trigger
- after a click opens one menu, hovering another trigger switches to it
- a press outside closes the open menu
- Enter on an item runs it and closes the menu
- a tap opens a menu and a tap on an item runs it
- axe finds no violations with a menu open
### Limits
- Every row passes on every project; a flaky row gets at most two retries.
- Size: at most 22.0 KiB gzip for `@texuli/primitives/menubar` (`pnpm size`).
- Open-to-focus: p75 at most 150 ms (asserted with `TEXULI_PERF=1`).
Menubar
A horizontal bar of menus, as in a desktop application.
- Import
import * as Menubar from '@texuli/primitives/menubar';- Pattern
- Menubar (WAI-ARIA APG)
- Size budget
- 22.0 KiB gzip for @texuli/primitives/menubar
- Reference
packages/primitives/ docs/ prim-menubar.md
Loading the Menubar demo…
Anatomy
Menubar.RootMenubar.MenuMenubar.TriggerMenubar.PortalMenubar.ContentMenubar.ItemMenubar.CheckboxItemMenubar.RadioGroupMenubar.RadioItem
Menubar.SeparatorMenubar.SubMenubar.SubTriggerMenubar.SubContent
Behavior checks
tests/behavior/scenarios/menubar.spec.ts runs 12 rows against the Menubar scenario on Chromium, WebKit and the Pixel 7. Each row asserts what a user or assistive technology can observe, held to the WAI-ARIA Authoring Practices pattern.
All 12 rows
- a named menubar of menuitems that open menus, collapsed
- the menubar is one Tab stop: Tab leaves it from any trigger
- ArrowRight and ArrowLeft move between triggers, skipping the disabled one
- Enter on a trigger opens its menu on the first item
- in an open menu, ArrowRight and ArrowLeft open the next and previous menus
- ArrowRight on a submenu trigger opens the submenu; ArrowLeft closes it
- Escape closes the menu and returns focus to its trigger
- after a click opens one menu, hovering another trigger switches to it
- a press outside closes the open menu
- Enter on an item runs it and closes the menu
- a tap opens a menu and a tap on an item runs it
- axe finds no violations with a menu open
Limits
- Every row passes on every project; a flaky row gets at most two retries.
- Size: at most 22.0 KiB gzip for
@texuli/primitives/menubar(pnpm size). - Open-to-focus: p75 at most 150 ms (asserted with
TEXULI_PERF=1).