Skip to content

Dropdown menu

A menu button: trigger plus an NxMenu panel with focus management.

View as Markdown

Preview

More The preview opens its menu. The code is the closed trigger, all NxDropdownMenu renders until it opens.

<div class="nx-dropdown">
  <button type="button" class="nx-dropdown__trigger"
      aria-haspopup="menu" aria-expanded="false" aria-label="More">
    <svg width="16" height="16" viewBox="0 0 24 24" fill="none"
        stroke="currentColor" stroke-width="2"
        stroke-linecap="round" stroke-linejoin="round"
        aria-hidden="true" focusable="false">
      <circle cx="12" cy="12" r="1" />
      <circle cx="19" cy="12" r="1" />
      <circle cx="5" cy="12" r="1" />
    </svg>
    More
  </button>
</div>

API

React props (NxKit)

React (NxKit) props
PropTypeDefaultRequiredDescription
triggerReactNodeRequiredButton content.
triggerLabelstringRequiredAccessible name.
itemsNxMenuItem[]RequiredMenu items.
align"start" | "end""end"Panel alignment.

Classes

Framework-agnostic classes
ClassDescription
.nx-dropdown__triggerNeutral menu button

Accessibility

  • WAI-ARIA menu button: aria-haspopup/expanded, Escape and outside click close, focus returns to the trigger.

Do / Don’t

  • Do: Use for secondary navigation and overflow actions.Don't hide the page's primary action in a dropdown.

View in spec