Skip to content
navius

Menubar

A visually persistent menu common in desktop applications that provides quick access to a consistent set of commands.

Features

  • Can be controlled (@bind-Value) or uncontrolled (DefaultValue); at most one menu open at a time.
  • Roving tabindex across the top-level triggers, with "follow focus" reopening as you arrow between menus.
  • Supports submenus with configurable side/align, checkbox items, and radio groups.
  • Items can be disabled, and full keyboard navigation with type-ahead is built in.
  • Content self-portals to document.body and is positioned by the engine, escaping overflow and stacking contexts.
  • Direction-aware: flips arrow keys and submenu sides in RTL.

Installation

Reference the Navius.Primitives package for the headless primitive, or vendor a styled version with the CLI: navius add copies the styled zits/ui component plus the brain files it depends on.

Anatomy

Import the parts and assemble them.

API Reference

Contains all the parts of a menubar. Renders a div with role="menubar".

Prop Type Default
Value string? -
ValueChanged EventCallback<string?> -
DefaultValue string? -
Orientation string "horizontal"
Dir string? -
Loop bool false
Modal bool true
ChildContent RenderFragment? -
Attributes IDictionary<string, object>? -
Data attribute Values
[data-orientation] "horizontal" | "vertical"

Groups a trigger and its content into one menu. Renders no DOM of its own.

Prop Type Default
Value string -
ChildContent RenderFragment? -

Toggles the menu it belongs to. Renders a button with role="menuitem".

Prop Type Default
Disabled bool false
ChildContent RenderFragment? -
Attributes IDictionary<string, object>? -
Data attribute Values
[data-popup-open] Present while the menu is open.
[data-highlighted] Present when highlighted
[data-disabled] Present when disabled

Teleports the popup into document.body (or Container). Renders no DOM of its own.

Prop Type Default
Container string? document.body
KeepMounted bool false
ChildContent RenderFragment? -

Owns placement (side / align / offsets / collision). A flag-setter that publishes the placement options; the Popup renders the positioning element the engine anchors to the trigger.

Prop Type Default
Side string "bottom"
Align string "start"
SideOffset double 0
AlignOffset double 0
Flip bool true
AvoidCollisions bool true
CollisionPadding double? -
Sticky string? -
HideWhenDetached bool false
ArrowPadding double 0
ChildContent RenderFragment? -
Attributes IDictionary<string, object>? -

The menu surface, wrapped by the Positioner and self-portaled to document.body. Renders a div with role="menu".

Prop Type Default
Loop bool false
KeepMounted bool false
OnOpenAutoFocus EventCallback<NaviusOpenAutoFocusEventArgs> -
OnCloseAutoFocus EventCallback<NaviusCloseAutoFocusEventArgs> -
OnEscapeKeyDown EventCallback<NaviusEscapeKeyDownEventArgs> -
OnPointerDownOutside EventCallback<NaviusPointerDownOutsideEventArgs> -
OnFocusOutside EventCallback<NaviusFocusOutsideEventArgs> -
OnInteractOutside EventCallback<NaviusInteractOutsideEventArgs> -
ChildContent RenderFragment? -
Attributes IDictionary<string, object>? -
Data attribute Values
[data-open] Present while open.
[data-closed] Present while closing (through the exit transition).
[data-starting-style] Present at the start of the open transition.
[data-ending-style] Present at the start of the close transition.
[data-side] "top" | "right" | "bottom" | "left"
[data-align] "start" | "center" | "end"
[data-orientation] "vertical"

An optional arrow pointing from the content at its trigger. Renders an svg.

Prop Type Default
Width double 10
Height double 5
Attributes IDictionary<string, object>? -

A selectable item inside a menu. Renders a div with role="menuitem".

Prop Type Default
Disabled bool false
TextValue string? -
OnSelect EventCallback<NaviusSelectEventArgs> -
ChildContent RenderFragment? -
Attributes IDictionary<string, object>? -
Data attribute Values
[data-highlighted] Present when highlighted
[data-disabled] Present when disabled

Groups related items. Renders a div with role="group".

Prop Type Default
ChildContent RenderFragment? -
Attributes IDictionary<string, object>? -

A non-interactive label, skipped by roving focus. Renders a div.

Prop Type Default
ChildContent RenderFragment? -
Attributes IDictionary<string, object>? -

An item that can be checked, like a checkbox. Renders a div with role="menuitemcheckbox".

Prop Type Default
Checked bool? -
CheckedChanged EventCallback<bool?> -
DefaultChecked bool? -
Disabled bool false
TextValue string? -
OnSelect EventCallback<NaviusSelectEventArgs> -
ChildContent RenderFragment? -
Attributes IDictionary<string, object>? -
Data attribute Values
[data-checked] Present when checked.
[data-unchecked] Present when unchecked.
[data-indeterminate] Present when in the indeterminate state.
[data-highlighted] Present when highlighted
[data-disabled] Present when disabled

Groups radio items so exactly one is selected. Renders a div with role="group".

Prop Type Default
Value string? -
ValueChanged EventCallback<string?> -
DefaultValue string? -
ChildContent RenderFragment? -
Attributes IDictionary<string, object>? -

An item that can be checked within a radio group. Renders a div with role="menuitemradio".

Prop Type Default
Value string -
Disabled bool false
TextValue string? -
OnSelect EventCallback<NaviusSelectEventArgs> -
ChildContent RenderFragment? -
Attributes IDictionary<string, object>? -
Data attribute Values
[data-checked] Present when checked.
[data-unchecked] Present when unchecked.
[data-highlighted] Present when highlighted
[data-disabled] Present when disabled

Renders only when its parent checkbox/radio item is checked. Renders a span.

Prop Type Default
ForceMount bool false
ChildContent RenderFragment? -
Attributes IDictionary<string, object>? -
Data attribute Values
[data-checked] Present when checked.
[data-unchecked] Present when unchecked.

A visual divider between items. Renders a div with role="separator".

Prop Type Default
Attributes IDictionary<string, object>? -

Contains the parts of a submenu, with its own open state. Renders no DOM of its own.

Prop Type Default
Open bool false
OpenChanged EventCallback<bool> -
DefaultOpen bool false
ChildContent RenderFragment? -

An item that opens a submenu. Renders a div with role="menuitem".

Prop Type Default
Disabled bool false
TextValue string? -
Dir string? -
ChildContent RenderFragment? -
Attributes IDictionary<string, object>? -
Data attribute Values
[data-popup-open] Present while the submenu is open.
[data-highlighted] Present when highlighted
[data-disabled] Present when disabled

The submenu surface, anchored to the SubTrigger and portaled. Renders a div with role="menu".

Prop Type Default
Side string "right"
Align string "start"
SideOffset double 0
AlignOffset double 0
AvoidCollisions bool true
CollisionPadding double? -
Loop bool false
ForceMount bool false
Container string? document.body
Dir string? -
ChildContent RenderFragment? -
Attributes IDictionary<string, object>? -
Data attribute Values
[data-open] Present while open.
[data-closed] Present while closing (through the exit transition).
[data-side] "top" | "right" | "bottom" | "left"
[data-align] "start" | "center" | "end"
[data-orientation] "vertical"

Accessibility

Implements the roles, states, and keyboard map of the menu & menubar WAI-ARIA APG pattern. Covered by the browser test suite and an axe-core WCAG gate in CI.

Key Description
Space When focus is on a trigger, opens the menu. When on an item, activates it.
Enter When focus is on a trigger, opens the menu. When on an item, activates it.
ArrowDown When focus is on a trigger, opens the menu and moves focus to the first item. When on an item, moves to the next item.
ArrowUp When focus is on a trigger, opens the menu and moves focus to the last item. When on an item, moves to the previous item.
ArrowRight When focus is on a trigger, moves to the next trigger. Inside an open menu, opens a submenu or moves to the next top-level menu (flipped in RTL).
ArrowLeft When focus is on a trigger, moves to the previous trigger. Inside a submenu, closes it and returns focus to the SubTrigger; otherwise moves to the previous top-level menu (flipped in RTL).
Home Moves focus to the first trigger or, inside a menu, the first item.
End Moves focus to the last trigger or, inside a menu, the last item.
Esc Closes the open menu and returns focus to its trigger.
A–Z, a–z Type-ahead: moves focus to the next item whose label starts with the typed characters.