MenuBar

A fixed horizontal top bar composed of a brand slot and a right-aligned actions slot.

Installation

npx dafink-ui add menu-bar

Also installs: Icons, Menu

Demo

Acme

Composition

<MenuBar>
<MenuBarBrand />
<MenuBarNav>/* sliding-pill nav group */
<MenuBarNavItem />
<MenuBarNavMore />/* overflow dropdown */
</MenuBarNav>
<MenuBarActions />
</MenuBar>

Props

NameTypeDefaultDescription
heightstring'h-14'Tailwind height class for the bar.
classNamestring''Additional CSS classes.
childrenReactNodeundefinedMenuBar content (brand, nav, search, actions).

Accessibility

MenuBarNav uses roving tabindex: only the active item (or the first enabled item, before anything is active) sits in the page's Tab order, and the whole MenuBar acts as one tab stop: arrow keys move between every control in it, while Tab and Shift+Tab leave the bar entirely. MenuBarNavItem sets aria-current="page" instead of aria-pressed since this is a navigation landmark, not a toggle group, and MenuBarNavMore composes Menu unmodified, so its own overlay keyboard behavior (focus on open, Escape closes and returns focus to the trigger, arrow-key navigation, typeahead) applies once its dropdown is open.

KeyFunction
tabEnters the bar at the nav group's active item; from anywhere inside the bar, moves focus out to the next page element.
shift+tabFrom anywhere inside the bar, moves focus out to the previous page element.
enterActivates the focused item, or opens the dropdown when focus is on MenuBarNavMore.
spaceActivates the focused item, or opens the dropdown when focus is on MenuBarNavMore.
right arrowMoves focus to the next control in the bar, including search and sign in, wrapping from the last to the first. Ignored inside text inputs.
left arrowMoves focus to the previous control in the bar, wrapping from the first to the last. Ignored inside text inputs.
homeMoves focus to the first control in the bar. Ignored inside text inputs.
endMoves focus to the last control in the bar. Ignored inside text inputs.