Menu
A dropdown menu of actions behind a button.
Inverted theme
Right to left
Delivery
Courier, with status emails.
<template> <div class="flex flex-col items-start gap-3"> <NuiMenu> <template #trigger="{ attrs }"> <NuiButton v-bind="attrs" variant="outline" tone="neutral" icon-end="chevron-down"> Actions </NuiButton> </template> <NuiMenuItem icon="copy" shortcut="mod+d" @select="done = 'A copy of order 20408 is ready.'"> Duplicate </NuiMenuItem> <NuiMenuItem :icon="Printer" shortcut="mod+p" @select="done = 'The packing slip is printing.'" > Print packing slip </NuiMenuItem> <NuiMenuSub label="Send to customer" icon="inbox"> <NuiMenuItem @select="done = 'The invoice went to the customer by email.'" >Invoice</NuiMenuItem > <NuiMenuItem @select="done = 'The payment link went out by text.'" >Payment link</NuiMenuItem > </NuiMenuSub> <NuiMenuSeparator /> <NuiMenuLabel>Delivery</NuiMenuLabel> <NuiMenuRadioGroup v-model="delivery"> <NuiMenuRadioItem v-for="method in methods" :key="method.value" :value="method.value"> {{ method.label }} </NuiMenuRadioItem> </NuiMenuRadioGroup> <NuiMenuSeparator /> <NuiMenuCheckboxItem v-model:checked="letters">Status emails</NuiMenuCheckboxItem> <NuiMenuSeparator /> <NuiMenuItem icon="trash" tone="error" @select="done = 'Order 20408 is canceled.'"> Cancel order </NuiMenuItem> </NuiMenu> <p class="m-0 text-sm text-muted-foreground">{{ summary }}</p> </div></template><script setup lang="ts">import { computed, ref } from 'vue';import { Printer } from '@lucide/vue';import { NuiButton, NuiMenu, NuiMenuCheckboxItem, NuiMenuItem, NuiMenuLabel, NuiMenuRadioGroup, NuiMenuRadioItem, NuiMenuSeparator, NuiMenuSub,} from '@numior/kit';import { DELIVERIES } from './orders';const delivery = ref('courier');const letters = ref(true);const done = ref('');const methods = Object.entries(DELIVERIES).map(([value, label]) => ({ value, label }));const summary = computed(() => { const method = methods.find((entry) => entry.value === delivery.value)?.label ?? ''; const status = letters.value ? 'with status emails' : 'no status emails'; return `${method}, ${status}. ${done.value}`.trim();});</script>export type OrderStatus = 'pending' | 'paid' | 'shipped' | 'delivered' | 'cancelled';export type Payment = 'card' | 'transfer' | 'cash';export type Delivery = 'courier' | 'pickup' | 'post';export interface OrderLine { readonly sku: string; readonly name: string; readonly quantity: number; readonly price: number;}export interface Order { readonly id: number; readonly date: string; readonly customer: string; readonly city: string; readonly status: OrderStatus; readonly payment: Payment; readonly delivery: Delivery; readonly manager: string; readonly total: number; readonly lines: readonly OrderLine[];}export const ORDER_STATUSES: Record<OrderStatus, string> = { pending: 'Awaiting payment', paid: 'Paid', shipped: 'Shipped', delivered: 'Delivered', cancelled: 'Canceled',};export const PAYMENTS: Record<Payment, string> = { card: 'Card', transfer: 'Bank transfer', cash: 'On delivery',};export const DELIVERIES: Record<Delivery, string> = { courier: 'Courier', pickup: 'Pickup', post: 'Mail',};export const orders: readonly Order[] = [ { id: 20401, date: '2026-09-16', customer: 'Peter Wolfe', city: 'Boston', status: 'delivered', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 307, lines: [ { sku: 'S-101', name: 'Oslo armchair', quantity: 1, price: 249 }, { sku: 'X-507', name: 'Linen pillow', quantity: 2, price: 29 }, ], }, { id: 20402, date: '2026-09-17', customer: 'Lena Ortiz', city: 'Chicago', status: 'delivered', payment: 'card', delivery: 'pickup', manager: 'Anna Turner', total: 138, lines: [{ sku: 'L-401', name: 'Nord table lamp', quantity: 2, price: 69 }], }, { id: 20403, date: '2026-09-18', customer: 'Tim Sayed', city: 'Denver', status: 'delivered', payment: 'transfer', delivery: 'courier', manager: 'Maria Kim', total: 507, lines: [ { sku: 'T-201', name: 'Malmo desk', quantity: 1, price: 329 }, { sku: 'S-104', name: 'Bergen chair', quantity: 2, price: 89 }, ], }, { id: 20404, date: '2026-09-19', customer: 'Vera Lane', city: 'Boston', status: 'cancelled', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 180, lines: [{ sku: 'S-110', name: 'Loft stool', quantity: 4, price: 45 }], }, { id: 20405, date: '2026-09-20', customer: 'Glen Nash', city: 'Austin', status: 'delivered', payment: 'cash', delivery: 'post', manager: 'Maria Kim', total: 175, lines: [ { sku: 'X-501', name: 'Wool throw', quantity: 1, price: 59 }, { sku: 'X-507', name: 'Linen pillow', quantity: 4, price: 29 }, ], }, { id: 20406, date: '2026-09-21', customer: 'Evan Porter', city: 'Seattle', status: 'shipped', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 199, lines: [{ sku: 'H-301', name: 'Vik shelving unit', quantity: 1, price: 199 }], }, { id: 20407, date: '2026-09-22', customer: 'Mary Cooper', city: 'Portland', status: 'shipped', payment: 'transfer', delivery: 'post', manager: 'Maria Kim', total: 416, lines: [ { sku: 'L-408', name: 'Arc floor lamp', quantity: 1, price: 119 }, { sku: 'L-412', name: 'Sphere pendant', quantity: 3, price: 99 }, ], }, { id: 20408, date: '2026-09-23', customer: 'Paul Hawkins', city: 'Boston', status: 'shipped', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 368, lines: [ { sku: 'H-305', name: 'Fjord dresser', quantity: 1, price: 299 }, { sku: 'L-401', name: 'Nord table lamp', quantity: 1, price: 69 }, ], }, { id: 20409, date: '2026-09-24', customer: 'Olga Graham', city: 'Chicago', status: 'paid', payment: 'card', delivery: 'pickup', manager: 'Maria Kim', total: 139, lines: [{ sku: 'T-207', name: 'Tromso coffee table', quantity: 1, price: 139 }], }, { id: 20410, date: '2026-09-25', customer: 'Sam Ellis', city: 'Denver', status: 'paid', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 863, lines: [ { sku: 'S-104', name: 'Bergen chair', quantity: 6, price: 89 }, { sku: 'T-201', name: 'Malmo desk', quantity: 1, price: 329 }, ], }, { id: 20411, date: '2026-09-26', customer: 'Nina Hart', city: 'Austin', status: 'pending', payment: 'transfer', delivery: 'courier', manager: 'Maria Kim', total: 498, lines: [{ sku: 'S-101', name: 'Oslo armchair', quantity: 2, price: 249 }], }, { id: 20412, date: '2026-09-27', customer: 'Alina Yusuf', city: 'Portland', status: 'pending', payment: 'card', delivery: 'pickup', manager: 'Anna Turner', total: 187, lines: [ { sku: 'X-501', name: 'Wool throw', quantity: 2, price: 59 }, { sku: 'L-401', name: 'Nord table lamp', quantity: 1, price: 69 }, ], },];Put the button into the trigger slot and bind the slot's attrs to it. Build the menu from these parts:
NuiMenuItemruns an action or opens a link.NuiMenuCheckboxItemturns an option on and off.NuiMenuRadioGroupwithNuiMenuRadioItempicks one option of several.NuiMenuSubopens a nested menu.NuiMenuLabelnames a group of items.NuiMenuSeparatordraws a line between groups.
Installation
import { NuiMenu, NuiMenuItem } from '@numior/kit';Usage
Open the menu and change its side, its distance from the button and closing after a choice.
Inverted theme
Right to left
<template> <NuiMenu :items="actions"> <template #trigger="{ attrs }"> <NuiButton v-bind="attrs" variant="outline" tone="neutral">Order actions</NuiButton> </template> </NuiMenu></template><script setup lang="ts">import { NuiButton, NuiMenu, type NuiMenuEntry } from '@numior/kit';const actions: NuiMenuEntry[] = [ { label: 'Open the order', icon: 'eye' }, { label: 'Duplicate', icon: 'copy' }, { label: 'Assign a manager', icon: 'user' }, { type: 'separator' }, { label: 'Cancel the order', icon: 'trash', tone: 'error' },];</script>Examples
Describe a menu with an array
Pass the items in items.
Inverted theme
Right to left
Order 20411, Nina Hart
The order is awaiting payment.
<template> <div class="flex flex-col gap-3 w-full max-w-sm"> <div class="flex items-center justify-between gap-3 text-sm"> <span>Order 20411, Nina Hart</span> <NuiMenu :items="entries" placement="bottom-end" label="Actions for order 20411"> <template #trigger="{ attrs }"> <NuiButton v-bind="attrs" variant="ghost" tone="neutral" icon="ellipsis" aria-label="Actions for order 20411" /> </template> </NuiMenu> </div> <p class="m-0 text-sm text-muted-foreground">{{ status }}</p> </div></template><script setup lang="ts">import { ref } from 'vue';import { NuiButton, NuiMenu, type NuiMenuEntry } from '@numior/kit';const status = ref('The order is awaiting payment.');const entries: NuiMenuEntry[] = [ { label: 'Open order', icon: 'eye', href: '#order-20411' }, { label: 'Send payment reminder', icon: 'inbox', onSelect: () => { status.value = 'The payment reminder went to the customer.'; }, }, { type: 'separator' }, { label: 'Cancel order', icon: 'trash', tone: 'error', onSelect: () => { status.value = 'Order 20411 is canceled.'; }, },];</script>Each entry is an object, and its type field sets the kind of the entry:
type | Entry | Fields |
|---|---|---|
none or item | An action or a link | label, icon, shortcut, tone, href, to, onSelect |
checkbox | An option with a check | label, icon, checked, onCheckedChange |
radio-group | A choice of one option | value, items, onChange |
sub | A nested menu | label, icon, items |
label | A group heading | label |
separator | A line between groups | none |
Behavior
- A click on the button opens the menu with no item highlighted. ArrowDown then goes to the first item and ArrowUp to the last one.
- Enter, Space or ArrowDown on the button open the menu at the first item, and ArrowUp at the last one.
- The pointer highlights the item under it without the focus ring, which comes back with the first key press.
- Choosing an item closes the menu, and
:close-on-select="false"keeps it open. A checkbox item keeps the menu open by default, so the user can check several options. - A nested menu opens on hover after a short delay, or with Enter or ArrowRight. A click outside closes every level at once.
Accessibility
A screen reader announces that the button opens a menu and whether the menu is open. Checkbox and radio items are announced as checked or not checked.
When the menu closes from the keyboard, the focus returns to the button. Arrow keys skip disabled items, and an item with href or to is a link.
Keys | Action | |
|---|---|---|
↓ | On the trigger, opens the menu at the first item. Inside, moves to the next item. | |
↑ | On the trigger, opens the menu at the last item. Inside, moves to the previous item. | |
↵ | Picks the item or opens the submenu. | |
Space | Picks the item or opens the submenu. | |
→ | Opens the submenu. Closes it in right-to-left layouts. | |
← | Closes the submenu. Opens it in right-to-left layouts. | |
Home | Moves to the first item. | |
End | Moves to the last item. | |
Esc | Closes the open submenu or the menu itself. | |
⇥ | Closes the whole menu. |
API
NuiMenu
Props
Name | Type | Default | Description | |
|---|---|---|---|---|
id | string | — | Id of the menu. Generated automatically by default. | |
placement | Placement | "bottom-start" | Side of the trigger the menu opens on, such as bottom-start. | |
offset | number | FLOATING_OFFSET | Distance from the trigger in pixels. Defaults to 4, as for every dropdown list. | |
items | readonly NuiMenuEntry[] | — | Menu entries as an array instead of child components. | |
closeOnSelect | boolean | true | Closes the menu after an item is picked. | |
loop | boolean | true | Arrow keys wrap from the last item to the first and back. | |
typeahead | boolean | true | Moves focus to an item when the user types its first letters. | |
label | string | — | Menu label for screen readers. Without it, the trigger text labels the menu. | |
anchor | HTMLElement | null | — | Element in place of the trigger slot, such as a table cell. Open the menu with show. Focus returns to the element on close. | |
compact | boolean | false | Removes the minimum menu width. Suits icon-only items. | |
lazy | boolean | false | Creates the items on the first open. Suits large menus in tables, not navigation: the server renders no items. |
Models
Name | Type | Default | Description | |
|---|---|---|---|---|
v-model:open | boolean | false | Whether the menu is open. |
Slots
Name | Slot props | Description | |
|---|---|---|---|
trigger | NuiMenuTriggerSlot | Button that opens the menu. Receives attrs for v-bind and open. | |
default | any | Items, groups and separators of the menu. |
Exposed
Name | Type | Description | |
|---|---|---|---|
triggerElement | HTMLElement | null | The trigger slot button element while the menu is mounted. | |
show | (focus?: NuiMenuFocus | undefined) => void | Opens the menu. With first or last, focuses the first or last item. |
NuiMenuItem
Props
Name | Type | Default | Description | |
|---|---|---|---|---|
icon | IconSource | — | Icon before the label, such as settings. | |
shortcut | string | — | Keyboard shortcut at the end of the row, such as Ctrl+C. | |
disabled | boolean | false | Disables the item: it stays visible but cannot be picked. | |
tone | NuiMenuItemTone | "neutral" | Color of the item: neutral, or a red error for destructive actions such as deleting. | |
closeOnSelect | boolean | — | Closes the menu after picking. Overrides closeOnSelect of the menu. | |
href | string | — | Address the item points to. The item becomes a link. | |
to | string | object | — | Route for RouterLink, NuxtLink or the configured link. Without a router, a string becomes href. | |
as | string | Component | — | Link component for to in place of the app router. |
Events
Name | Payload | Description | |
|---|---|---|---|
select | [] | Fires when the item is picked with the keyboard or the mouse. |
Slots
Name | Slot props | Description | |
|---|---|---|---|
default | any | Text of the item. | |
trailing | any | Content at the end of the row, for example a check mark. |
NuiMenuCheckboxItem
Props
Name | Type | Default | Description | |
|---|---|---|---|---|
icon | IconSource | — | Icon before the label, such as settings. | |
disabled | boolean | false | Disables the item: it stays visible but cannot be picked. | |
closeOnSelect | boolean | false | Closes the menu after toggling. |
Models
Name | Type | Default | Description | |
|---|---|---|---|---|
v-model:checked | boolean | false | Whether the item is checked. |
Events
Name | Payload | Description | |
|---|---|---|---|
select | [] | Fires when the item is picked with the keyboard or the mouse. |
Slots
Name | Slot props | Description | |
|---|---|---|---|
default | {} | Text of the item. |
NuiMenuRadioGroup
Props
Name | Type | Default | Description | |
|---|---|---|---|---|
getKey | NuiOptionKey<NonNullable<T>> | — | Function that returns the key of an object value; the selected item is found by this key. Without it the JSON of the value is the key. |
Models
Name | Type | Default | Description | |
|---|---|---|---|---|
v-model | T | — | Value of the selected item. |
Slots
Name | Slot props | Description | |
|---|---|---|---|
default | {} | NuiMenuRadioItem items. |
NuiMenuRadioItem
Props
Name | Type | Default | Description | |
|---|---|---|---|---|
value*required required | T | — | Value the group v-model receives. | |
icon | IconSource | — | Icon before the label, such as settings. | |
disabled | boolean | false | Disables the item: it stays visible but cannot be picked. | |
closeOnSelect | boolean | true | Closes the menu after picking. |
Events
Name | Payload | Description | |
|---|---|---|---|
select | [] | Fires when the item is picked with the keyboard or the mouse. |
Slots
Name | Slot props | Description | |
|---|---|---|---|
default | {} | Text of the item. |
NuiMenuLabel
Slots
Name | Slot props | Description | |
|---|---|---|---|
default | {} | Group heading text. |
NuiMenuSeparator
NuiMenuSub
Props
Name | Type | Default | Description | |
|---|---|---|---|---|
id | string | — | Id of the submenu. Generated automatically by default. | |
label | string | — | Label of the item that opens the submenu. | |
icon | IconSource | — | Icon before the label, such as settings. | |
disabled | boolean | false | Disables the item: it stays visible but cannot be picked. | |
openDelay | number | 100 | Delay in milliseconds before the submenu opens on hover. | |
closeDelay | number | 300 | Delay in milliseconds before the submenu closes after the pointer leaves. |
Slots
Name | Slot props | Description | |
|---|---|---|---|
label | any | Label markup in place of the label text. | |
default | any | Submenu items. |