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: Dropdown-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, so Tab moves into and out of the whole nav group in a single stop, the same mechanic as ToggleGroup. MenuBarNavItem sets aria-current="page" instead of aria-pressed since this is a navigation landmark, not a toggle group, and MenuBarNavMore composes DropdownMenu 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
tabMoves focus to the nav group's active item, or out to the next tabbable element if focus is already inside the group.
shift+tabMoves focus out of the nav group to the previous tabbable 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 item, wrapping from the last item to the first.
left arrowMoves focus to the previous item, wrapping from the first item to the last.
homeMoves focus to the first enabled item.
endMoves focus to the last enabled item.