Menu
Dropdown menu for structured actions with grouped items, submenus, checkbox and radio items, and horizontal layouts.
import {
Menu,
MenuContent,
MenuItem,
MenuLink,
MenuSeparator,
MenuTrigger,
} from "@plexui/vue/components/Menu";One iOS menu, opened three ways: Menu from a button of actions, Select from a button that shows a value, as an iOS pop-up button, and Context Menu from a touch and hold or a secondary click on an element. Select Control is Select's button alone, for a list of your own. On a phone the three menus draw the same rows, described once under Menu › On a phone.
Examples
Overview
Natural sizing
Horizontal (icons only)
Mode switch
Header
Grouped items
Submenus
Checkbox items
Radio items
Item actions
Destructive items
API
Note: Menu prevents Tab from advancing focus. For generic popover content use Popover instead.
Menu (root)
| Prop | Type | Default | Description |
|---|---|---|---|
force-open | boolean | — | Keep menu open (controlled) |
modal | boolean | false | Whether menu is modal (focus trap) |
@open | () => void | — | Emitted when menu opens |
@close | () => void | — | Emitted when menu closes |
MenuTrigger: renders its child (e.g. a Button) as the element that toggles the menu. Other attributes and listeners reach the child.
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | false | Prevent the menu from opening |
MenuContent
| Prop | Type | Default | Description |
|---|---|---|---|
width | number | "auto" | fits content, 250 on a phone | Panel width (numbers are pixels). Without it the panel fits its content, or with touch.css on a phone is 250px, as an iOS menu; "auto" fits the content there too |
min-width | number | "auto" | 300 | Minimum panel width |
max-height | number | — | Maximum panel height, in pixels |
pill | boolean | false | Rounder list with fully rounded rows, for menus beside pill controls. MenuSubContent takes it too |
side | "top" | "right" | "bottom" | "left" | "bottom" | Preferred placement. Without it, and without side-offset, a menu on a phone opens upward from a trigger in the lower half of the screen |
side-offset | number | 5 | Distance from the trigger, in pixels. Without it a menu on a phone covers its trigger |
align | "start" | "center" | "end" | "center" | Alignment relative to trigger |
align-offset | number | -5 | Offset from the start or end alignment, in pixels. 0 with center alignment, and on a phone when the menu covers its trigger |
layout | "vertical" | "horizontal" | "vertical" | Layout direction. Use horizontal for icon toolbars |
size | "sm" | "md" | "lg" | "md" | Size of horizontal menu items (icon size + padding) |
@close-auto-focus | (event: Event) => void | — | Emitted before focus returns to the trigger; call event.preventDefault() to keep it from moving there |
@open-auto-focus | (event: Event) => void | — | Emitted before focus moves into the menu as it opens; call event.preventDefault() to leave focus where it is, as for a menu that stands open when its screen appears |
MenuItem: list item. Listen to @select or @click for actions; without either the item is non-interactive content.
| Prop | Type | Default | Description |
|---|---|---|---|
description | string | — | Second line under the label (or the description slot). The label turns semibold on its own |
disabled | boolean | false | Disable the item |
danger | boolean | false | Destructive action: the item is drawn in the danger color |
@select | (event: Event) => void | — | Called when the item is selected; call event.preventDefault() to keep the menu open |
@click | (event: MouseEvent) => void | — | Called when the item is clicked; also makes the item interactive |
MenuLink: item that navigates. Internal paths render the link component from PlexUIProvider (for example vue-router's RouterLink); absolute http(s) URLs open in a new tab. Pass href or to, disabled (a disabled link does not navigate), danger, as and link attributes.
MenuSeparator: divider between items. No props.
MenuGroup: groups related items. Wraps MenuItem, MenuLink, or MenuLabel. No specific props.
MenuLabel: non-interactive label for a group. Accepts class.
MenuHeader: names what the menu acts on, above its items. The default slot is the title; the media slot is a picture before it (an image, an icon or an Avatar in a 32px square, 40px on a phone: an image or icon fills it, an image gets small rounded corners), and the action slot a MenuHeaderAction at the end.
| Prop | Type | Default | Description |
|---|---|---|---|
description | string | — | Line under the title, such as the kind and size of a file (or the description slot) |
MenuHeaderAction: round action at the end of a header, a menu item that closes the menu when selected. Its slot is the icon.
| Prop | Type | Default | Description |
|---|---|---|---|
aria-label | string | — | Accessible name of the icon-only action (required) |
disabled | boolean | false | Disable the action |
@select | (event: Event) => void | — | Emitted when the action is pressed; call event.preventDefault() to keep the menu open |
MenuSub / MenuSubTrigger / MenuSubContent: submenu wrapper (with force-open, @open and @close), trigger (with disabled, and description for a line under the label, as what the submenu has chosen; also a description slot), and content panel (with width, min-width, max-height, side-offset and align-offset).
MenuCheckboxItem
| Prop | Type | Default | Description |
|---|---|---|---|
checked / v-model:checked | boolean | "indeterminate" | false | Checked state |
@checked-change | (checked: boolean) => void | — | Emitted with update:checked when the checkbox toggles |
@select | (event: Event) => void | — | Call event.preventDefault() to keep the menu open |
indicator-position | "start" | "end" | "end" | Checkbox position |
indicator-variant | "solid" | "ghost" | "solid" | Indicator style |
disabled | boolean | false | Disable the item |
MenuRadioGroup / MenuRadioItem: radio group with v-model:value (plus @change), indicator-position and layout (default "vertical"; "horizontal" sets the options side by side as a mode switch, the chosen one on a fill); MenuRadioItem takes value, description (a line under the label, as the order of the chosen sort; also a description slot), disabled and @select.
MenuItemActions / MenuItemAction: MenuItemActions wraps hover actions; MenuItemAction emits @click and closes the menu.
Styling
Menu reads these component tokens. Override them at any scope to restyle it:
--menu-checkbox-indicator-size: checkbox indicator size (defaultvar(--font-text-lg-size))--menu-font-size: font size (defaultvar(--font-text-sm-size))--menu-gutter: gutter (defaultspacing(1.5))--menu-item-background-color: item background color (defaultlight-dark(var(--alpha-08), var(--alpha-10)))--menu-mobile-background: panel surface on a phone (defaultlight-dark(rgb(255 255 255 / 65%), var(--alpha-12))glass)--menu-mobile-backdrop-filter: blur behind the panel on a phone (defaultblur(18px))--menu-default-width: default width before a content-level override (none on desktop, 250px with touch styles)--menu-default-min-width: default minimum width before a content-level override (300px on desktop, 250px with touch styles)--menu-horizontal-min-width: minimum width of a horizontal menu (none on desktop, 250px with touch styles)--menu-item-press-scale: pressed surface scale (1 with touch styles; otherwise follows the pointer interaction scale)--menu-item-gap: item gap (defaultspacing(1.5))--menu-item-padding: item padding (defaultspacing(1.5) spacing(2))--menu-line-height: line height (defaultvar(--font-text-sm-line-height))--menu-radio-indicator-hole-size: radio indicator hole size (defaultvar(--font-text-3xs-size))--menu-radio-indicator-size: radio indicator size (defaultvar(--font-text-lg-size))--menu-radius: radius (defaultvar(--radius-xl);34pxon a phone withtouch.css, the iOS 27 kit Menu)--menu-scroll-fade: how far the items of a phone menu fade at an edge they scroll past (default32px)--menu-separator-background-color: separator background color (defaultvar(--color-border))--menu-separator-gutter: separator gutter (defaultvar(--menu-gutter) calc(-1 * var(--menu-gutter)))--menu-row-min-height: height of a phone menu row, the same in Menu, Context Menu and Select's list (42px with touch styles)--menu-row-padding-block: space above and below a phone row's text (10px with touch styles)--menu-description-font-size: font size of a phone row's subtitle (13px with touch styles)--menu-description-line-height: line height of a phone row's subtitle (18px with touch styles)--menu-check-slot-height: height of the checkmark's slot on a phone (22px with touch styles)--radio-group-indicator-background-color: indicator background color (defaultvar(--color-background-primary-solid))--radio-group-indicator-border-color: indicator border color (defaultvar(--color-border-primary-outline))--radio-group-indicator-border-color-hover: indicator border color hover (defaultvar(--alpha-25))--radio-group-indicator-hole-background-color: indicator hole background color (defaultvar(--color-text-primary-solid))
On a phone
On a phone a menu is the iOS menu. Menu, Context Menu and the list of a Select share its panel and its rows: the next two paragraphs hold for all three, and their pages link here. touch.css holds the row's measures once, in the tokens above. Submenus (Context Menu's are Menu's), where a menu opens and how it scrolls follow them; Context Menu and Select describe where theirs open on their pages.
With the optional touch.css stylesheet, phone menus use 34px corners (the iOS 27 kit Menu), 17px labels with 20px line height, and 13/18px subtitles. Rows are 42px, as in native iOS 26 menus, and long labels wrap and make a row taller. A pressed row is the capsule iOS draws under the finger: the whole row, 10px from the panel's edges, round at its ends, in one even gray (--menu-press-background). A checked item keeps its checkmark without a persistent background, centered 28px from the panel's edge with labels at 43.5px, as native menus draw it; in a menu with checkmarks, plain rows and section titles start where the labels do. A menu is 250px wide, as native iOS menus are, so a long label wraps under itself; an explicit width or minimum width still takes precedence.
A phone menu is glass over the page, as native iOS 27.2 menus are: white at 65% in the light theme and at 12% in the dark one, over an 18px blur of what is under it, which leaves the page's text unreadable through the panel (a 37 by 24pt switch knob behind a native menu spreads to 55 by 37pt). A thin edge draws the panel's outline on a white page, as native menus have. A trigger the panel covers whole, as a More button of a top bar, is hidden while the menu is open, as iOS turns a bar button into its menu; a wider trigger, as a form row, stays.
A submenu grows out of the row that opened it while the menu behind it steps back. It is 250px wide too, and one of auto width fits its content.
On a phone, a menu taller than the room it has scrolls its items inside the panel, and they fade out over 32px at an edge they scroll past, as the soft scroll edge of the iOS 27 kit; in a browser without scroll-driven animations they scroll without the fade.
On a phone a menu without side-offset grows out of its trigger and covers it, as iOS menus do: its top is the trigger's top, or its bottom when it opens upward, and its aligned edge is the trigger's edge. Without side it opens toward the larger part of the screen, upward from a trigger in the lower half even when it would fit below. A desktop keeps the 5px gap below the trigger.
On phones, menus and submenus inside a Page or Dialog keep clear of its visible footer. Their available space updates when the footer or viewport changes.
A phone here is a window 767px wide or narrower, or the inside of a PhoneLayout or a Dialog with layout="phone", at any window width. A menu opened in a PhoneLayout opens in its box and keeps inside it; one opened in a phone Dialog opens over the window, as on a phone.