Skip to content

Menu

Last updated 11 Nov 2026

NbMenu is a floating menu container for actions and options. It follows the Carbon Design System menu pattern with full keyboard navigation, submenus, selectable items, danger items, and dividers.

Basic menu ​

vue
<template>
  <NbButton ref="trigger" @click="toggleMenu">Actions</NbButton>
  <NbMenu ref="menu" v-model:open="menuOpen">
    <NbMenuItem label="Cut" shortcut="Cmd+X" @select="onCut" />
    <NbMenuItem label="Copy" shortcut="Cmd+C" @select="onCopy" />
    <NbMenuItem label="Paste" shortcut="Cmd+V" @select="onPaste" />
  </NbMenu>
</template>

<script setup>
import { ref } from 'vue'

const trigger = ref(null)
const menu = ref(null)
const menuOpen = ref(false)

function toggleMenu() {
  if (menuOpen.value) {
    menuOpen.value = false
  } else {
    const rect = trigger.value.$el.getBoundingClientRect()
    menu.value.setPosition(rect)
    menuOpen.value = true
  }
}
</script>

Use NbSubmenu to nest menus. The submenu opens on hover, on click, or from the keyboard with ArrowRight, Enter or Space, which also moves focus to its first item. It closes on mouse-leave, or with ArrowLeft or Escape, which hand focus back to the trigger.

vue
<NbMenu v-model:open="open">
  <NbMenuItem label="New File" shortcut="Cmd+N" />
  <NbSubmenu label="Open Recent">
    <NbMenuItem label="project.json" />
    <NbMenuItem label="readme.md" />
    <NbMenuItem label="index.ts" />
  </NbSubmenu>
  <NbMenuDivider />
  <NbMenuItem label="Save" shortcut="Cmd+S" />
</NbMenu>

A form in a menu ​

A menu can hold fields instead of items: a filter panel, or a quick edit opened from a placeholder. NbSelect and NbDatePicker draw their list and calendar outside the menu, and the menu knows they belong to it, so picking an option or a day does not count as a press outside and does not close it. Escape closes the menu from any field in it. When a field's list or calendar is open, the first Escape closes only that.

vue
<template>
  <NbMenu ref="menu" v-model:open="open">
    <NbSelect id="goal" v-model="goal" :options="goals" />
  </NbMenu>
</template>

NbMenu ​

Props ​

PropTypeDefaultDescription
openbooleanfalseControls menu visibility
size'xs' | 'sm' | 'md' | 'lg''md'Item height preset
minWidthnumber160Minimum width in px
maxWidthnumber288Maximum width in px

Events ​

EventPayloadDescription
closenoneEmitted when the menu requests to close
update:openbooleanFor v-model:open binding

Exposed methods ​

MethodSignatureDescription
setPosition(rect: { top, left, bottom, width }) => voidPosition menu below a trigger element
setPositionXY(x: number, y: number) => voidPosition menu at specific coordinates
close() => voidClose the menu programmatically

NbMenuItem ​

Props ​

PropTypeDefaultDescription
labelstringrequiredDisplay text
iconstringundefinedPhosphor icon name
picturestring | nullundefinedA picture in the icon's place, as a 16px NbAvatar. null draws the label's initials
shortcutstringundefinedKeyboard shortcut display text
disabledbooleanfalseDisables the item
disabledReasonstringundefinedWhy the item is disabled: a muted second line, its aria-describedby, and the arrow keys still stop on it. Read only while disabled
dangerbooleanfalseDestructive action styling
selectablebooleanfalseCheckbox-style toggle
selectedbooleanfalseWhether selectable item is checked
radioGroupstringundefinedRadio group name

Events ​

EventPayloadDescription
selectnoneEmitted when the item is activated

Slots ​

SlotDescription
leadingReplaces what leads the label (the picture or the icon), for anything the two props cannot say
trailingAfter the shortcut: a badge, a count, a secondary control

NbMenuDivider ​

No props. Renders a horizontal separator.

NbSubmenu ​

Props ​

PropTypeDefaultDescription
labelstringrequiredTrigger label
iconstringundefinedPhosphor icon name
disabledbooleanfalseDisables the submenu trigger
disabledReasonstringundefinedWhy the submenu is unavailable, as on NbMenuItem. It does not open. Read only while disabled

Slots ​

SlotDescription
defaultNbMenuItem and NbMenuDivider children