Navigation & Action Menus

3 components

Three triggers, one panel surface. Link-based hover menus for navigation, action-driven dropdowns for commands, and the account menu every signed-in surface opens from its avatar. Every panel here is NkPopover — portalled, flipped, one surface to keep in sync.

Navigation menus

Hover-intent menus whose rows are anchors. They belong in a top bar; everything further down this page is for commands.

NkNavMenu

link-based

Framework-agnostic hover-intent menu whose items are real anchors, so router prefetch and middle-click-to-open keep working. Inject any router's link (here Next's <Link>) via linkComponent. Opens on hover and on keyboard focus; closes on blur, Escape, or an outside click.

Action menus

react-aria action menus: a keyboard model (arrow keys, type-ahead, Escape) with no hand-rolled focus code, in a panel that stacks above dialogs instead of under them.

NkDropdownMenu

sections · submenu

react-aria action menu: arrow-key navigation, typeahead, disabled rows, labelled sections, separators, and a nested submenu. Rows fire through onClick and the menu closes on select — the destructive row tints rather than filling.

NkDropdownMenu

single section

A compact, single-section menu — the everyday shape for switching context or targets. Same panel surface as everything else: NkPopover, portalled, z-popover.

Account menu

NkUserMenu is the “who am I / where do I sign out” affordance, solved once: identity header, actions, footer, and a panel that survives any viewport corner by construction.

NkUserMenu

avatar → identity → actions

The signed-in corner every surface needs: avatar trigger, identity header (name, mail, badge), declarative items with a danger sign-out, and a footer strip that lives outside role="menu". onAction(id, item)fires for every row, after the row's own handler.

items + footerthe default trigger: an initials avatar
trigger render propreturns the button CONTENT, not a button — { isOpen } rotates the chevron

last action: — · open: false

Keyboard and screen reader, for free: the trigger is a real button labelled Account menu (override with label), so assistive tech says "Account menu, button, collapsed" before the avatar is ever seen; the popup is role="menu" under that same name, rows are role="menuitem", and arrow keys, Home/End, type-ahead and Escape come from react-aria-components. The popover is modal — it owns focus and closes on an outside interaction, exactly like NkDropdownMenu.

NkUserMenu

corner · portal · flip

Same component, two triggers pinned to the bottom corners of an overflow-hidden box — the ancestor that would clip any panel rendered in flow. Both panels clear the box, because the panel is NkPopover portalled to document.body at z-popover.

overflow-hidden box · triggers on both bottom corners

Against the real viewport the panel is pinned with shouldFlip (it flips to whichever side has more room, so it cannot flip-loop), containerPadding of 12px and offset of 4px — the contract that makes opening from any screen corner safe. When space is clamped short, the identity header and footer stay shrink-0 and the menu list alone scrolls, so you get a scrollbar instead of a sliced menu. Resize the window and open the bottom-right trigger to watch it flip upward at the real screen edge.