Skip to content

Menu

Popover action list with roving-tabindex keyboard navigation and a danger item variant.

Preview

Row actions

<div class="nx-menu" role="menu" aria-label="Row actions" aria-orientation="vertical"><button class="nx-menu__item nx-menu__item--active" type="button" role="menuitem" tabindex="0">Edit</button><button class="nx-menu__item" type="button" role="menuitem" tabindex="-1">Duplicate</button><button class="nx-menu__item nx-menu__item--disabled" type="button" role="menuitem" aria-disabled="true" tabindex="-1">Assign…</button><div class="nx-menu__sep" role="separator"></div><button class="nx-menu__item nx-menu__item--danger" type="button" role="menuitem" tabindex="-1">Delete</button></div>

API

React props (NxKit)

React (NxKit) props
PropTypeDefaultRequiredDescription
itemsNxMenuItem[]Requiredlabel/icon/active/onClick/separator/disabled/danger per item.
onClose()=>voidundefinedCalled on Escape — the consumer restores focus to the trigger.
autoFocusbooleanfalseFocus the first non-disabled item on mount.

Classes

Framework-agnostic classes
ClassDescription
.nx-menurole=menu popover, overlay shadow
.nx-menu__itemrole=menuitem button
.nx-menu__item--activeAccent tint + weight
.nx-menu__item--dangerDanger text, danger-tint hover
.nx-menu__item--disabledaria-disabled, skipped by roving nav
.nx-menu__seprole=separator divider

Accessibility

  • role="menu" / items role="menuitem"; one roving tab stop (first non-disabled item), ArrowUp/Down wrap, Home/End, Escape calls onClose.
  • Disabled items are aria-disabled (not the disabled attribute, since they're <button type="button"> acting as menu items) and are skipped by the roving walk.

Do / Don’t

  • Do: Put destructive actions last, marked danger.Don’t: Don't put more than ~8 items in one menu — group or paginate.

View in spec →