Menu
Menu presents grouped actions, choices, links, and submenus from a trigger button.
Purpose
Menu presents grouped actions, choices, links, and submenus from a trigger. Use form controls such as Select, Checkbox, or Switch when the value belongs to a form field.
Action menu
Installation
With the Siteplane registry alias configured, add the component and import the installed source from your app.
CLI
pnpm dlx shadcn@4.16.1 add @siteplane/menuImport
import { Menu, MenuCheckboxItem, MenuCreateHandle, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuSub, MenuSubPopup, MenuSubTrigger, MenuTrigger } from "@/components/ui/menu";Need the machine-readable source metadata? View registry JSON.
Usage
Use Menu for action lists and lightweight selection behind a trigger. Use Select for form values.
import { Menu, MenuItem, MenuPopup, MenuTrigger } from "@/components/ui/menu";
import { Button } from "@/components/ui/button";
export function Example() {
return (
<Menu>
<MenuTrigger render={<Button variant="outline" />}>Actions</MenuTrigger>
<MenuPopup><MenuItem>Duplicate</MenuItem></MenuPopup>
</Menu>
);
}Examples
Icons, shortcuts, groups, selection items, link items, submenus and popup width are props and compositions of the same primitive.
With icons and shortcuts
Grouped
Destructive item
Selection items
Switch items
variant="switch" stays a semantic checkbox item; the size prop scales the switch thumb.
Link items
Router links use MenuLinkItem with render instead of turning an item into a link.
Inset items
inset aligns plain items with items that carry a leading icon.
Popup width
width defaults to auto; content sizes to the widest item, and trigger or at-least-trigger follow the trigger width.
API Reference
The reference lists the source-owned exports and props that are easy to miss in visual examples. Inherited Base UI props remain available unless the wrapper narrows them.
MenuPopup sideaccepts top, right, bottom, left, inline-start, and inline-end and defaults to bottom.alignaccepts start, center, or end and defaults to center.sideOffsetdefaults to 4;alignOffsetadjusts the cross-axis position.anchorattaches the popup to another element or virtual anchor.widthaccepts"auto","trigger","content", or"at-least-trigger".- Use
inseton items, group labels, and submenu triggers to align rows without leading icons. MenuCheckboxItem sizeaccepts"sm","default","lg", and"xl".- All item, selection, label, separator, and submenu rows inherit the provider
controlSize; repeated rows use the compact menu geometry from the global size contract rather than the 56px XL CTA height. MenuLinkItem closeOnClickdefaults totrue; usefalseonly when the menu should remain open after navigation.MenuCreateHandlesupports detached triggers and imperative opening.- Use
disabledfor unavailable items and the native icon slot treatment for leading icons.
Motion
Component motion uses the shared Siteplane motion contract. See the global motion guide for provider setup, tokens and reduced-motion behavior.
- Popup and submenu placement, scale, fade, and reduced-motion behavior are native.
- Active items, selection items, and submenu triggers use a pointer cursor.
- Do not wrap the popup in a second animation.
Accessibility
- Give every trigger visible text or an accessible label.
- Give a popup without visible context an accessible menu label.
- Preserve Arrow key navigation, focus, Escape, outside click, and focus restoration.
- Keep disabled items unavailable and visibly distinct.
- Checkbox and radio items retain their selection indicators; shortcuts are supporting text only.
Implementation Guidance
- Use Menu for actions and menu choices, not ordinary form fields.
- Do not render raw items outside Menu and MenuPopup.
- Use placement, anchor, width, inset, size, link, disabled, and handle APIs instead of local menu implementations.
- Preserve native item, submenu, selection, cursor, focus, and motion behavior.