Skip to content
Focsd homeFocsd homeFocsd
Forms

Navigation menu

Site navigation with disclosure groups (not an application menu).

  • Tag: focsd-nav-menu
  • Pattern: Disclosure navigation
  • Category: Navigation

Example

HTML
<focsd-nav-menu label="Product">
<focsd-nav-item href="#" current>Overview</focsd-nav-item>
<focsd-nav-item label="Products">
<a href="#">Analytics</a>
<a href="#">Reports</a>
</focsd-nav-item>
<focsd-nav-item label="Company">
<a href="#">About</a>
</focsd-nav-item>
</focsd-nav-menu>

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-nav-menu.js';
</script>
<focsd-nav-menu label="Product">…</focsd-nav-menu>

API

Attributes

AttributePropertyTypeDefault
labellabelstring—
orientationorientation'horizontal' | 'vertical'horizontal

Slots

SlotDescription
(default)Default content.

CSS parts

Style the inside of the component with ::part(), for example focsd-nav-menu::part(list).

PartDescription
listThe list element.
navThe nav element.

Accessibility

  • APG disclosure navigation: groups are <button aria-expanded> that show their links; there is no role="menu", so links behave like links.
  • Opening one group closes the others; Escape closes and returns focus to its button; moving focus out closes it.

Keyboard

KeyAction
Enter / SpaceOpen or close a group
EscapeClose the open group
TabMove through links