Skip to content
Focsd homeFocsd homeFocsd
Forms

Menubar

A horizontal bar of application menus, like File and Edit.

  • Tag: focsd-menubar
  • Pattern: Menubar
  • Category: Navigation

Example

New Open Undo Redo Zoom
HTML
<focsd-menubar label="Editor">
<focsd-menubar-item label="File">
<focsd-menu-item value="new">New</focsd-menu-item>
<focsd-menu-item value="open">Open</focsd-menu-item>
</focsd-menubar-item>
<focsd-menubar-item label="Edit">
<focsd-menu-item value="undo">Undo</focsd-menu-item>
<focsd-menu-item value="redo">Redo</focsd-menu-item>
</focsd-menubar-item>
<focsd-menubar-item label="View">
<focsd-menu-item value="zoom">Zoom</focsd-menu-item>
</focsd-menubar-item>
</focsd-menubar>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/components/focsd-menubar.js';
</script>
<focsd-menubar label="Editor">…</focsd-menubar>

API

Attributes

AttributePropertyTypeDefault
labellabelstring—

Slots

SlotDescription
(default)Default content.

Accessibility

  • APG menubar: role="menubar" with one tab stop; each item is a role="menuitem" with aria-haspopup="menu" and aria-expanded.
  • Use only for application-style commands. For site navigation use focsd-nav-menu.

Keyboard

KeyAction
Arrow Left / RightMove between menus (and switch the open menu)
Enter / Space / Arrow DownOpen at the first item
Arrow UpOpen at the last item
EscapeClose and return focus