docs/components/menu
Sections
Components
Utilities
Forms
Hooks
Copy Markdown
List of options on button interaction.
PreviewCode
Open
CLIManual
pnpmbunnpmyarn
pnpm dlx shadcn@latest add @shark/menu
Menu
├── MenuTrigger
└── MenuPositioner
└── MenuContent
├── MenuGroup
│ └── MenuGroupLabel
├── MenuItem
├── MenuQuickItem
├── MenuCheckboxItem
├── MenuRadioGroup
│ └── MenuRadioItem
├── MenuSub
│ ├── MenuSubTrigger
│ └── MenuSubContent
├── MenuSeparator
├── MenuShortcut
└── MenuArrow
import {
Menu,
MenuCheckboxItem,
MenuContent,
MenuGroup,
MenuItem,
MenuQuickItem,
MenuRadioGroup,
MenuRadioItem,
MenuSeparator,
MenuShortcut,
MenuSub,
MenuSubContent,
MenuSubTrigger,
MenuTrigger,
} from "@/components/ui/menu";
<Menu>
<MenuTrigger />
<MenuContent>
<MenuItemGroup>
<MenuItemGroupLabel />
<MenuItem />
<MenuSub>
<MenuSubTrigger />
<MenuSubContent>
<MenuItem />
</MenuSubContent>
</MenuSub>
<MenuSeparator />
<MenuItemGroup>
<MenuRadioItem />
</MenuItemGroup>
<MenuSeparator />
<MenuCheckboxItem />
</MenuItemGroup>
</MenuContent>
</Menu>
Control the position of the menu relative to the trigger using the positioning prop.
PreviewCode
lefttopbottomright
Use MenuSub, MenuSubTrigger, and MenuSubContent for nested submenus.
PreviewCode
Open
Combine icons with labels for quick scanning.
PreviewCode
Open
Use MenuShortcut to show keyboard hints next to menu items.
PreviewCode
Open
Use MenuCheckboxItem for toggles.
PreviewCode
Open
Use MenuRadioGroup and MenuRadioItem for a single selection from a set of options.
PreviewCode
Open
Use the asChild prop on MenuItem with a anchor element to render a link.
PreviewCode
Open
Use MenuGroup with MenuGroupLabel or the heading prop to group related items under a label.
PreviewCode
Open
Use MenuSeparator to add visual dividers between related groups of menu items.
PreviewCode
Open
Use MenuQuickItem for actions with icon-above-text layout, ideal for quick actions like Copy and Share displayed horizontally.
PreviewCode
Open
Add max-h-* and overflow-y-auto to MenuContent to constrain height and enable native scrolling when there are many items.
PreviewCode
Open
Open a dialog from a MenuItem with the onSelect prop and controlled state.
PreviewCode
Open
Use variant="destructive" on MenuItem for irreversible actions like delete.
PreviewCode
Open
Root element of the menu component.
| Prop | Type | Default |
|---|---|---|
positioning | PositioningOptions | - |
open | boolean | - |
defaultOpen | boolean | - |
onOpenChange | (details: OpenChangeDetails) => void | - |
onSelect | (details: SelectionDetails) => void | - |
closeOnSelect | boolean | true |
Opens the menu on click. Use asChild to delegate to a child element.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
Holds menu options. Displayed in a portal, positioned relative to the trigger.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
A single selectable menu option. Supports asChild for custom elements.
| Prop | Type | Default |
|---|---|---|
value | string | required |
variant | `"default" | "destructive"` |
asChild | boolean | - |
disabled | boolean | - |
closeOnSelect | boolean | - |
onSelect | VoidFunction | - |
A menu option with a checkbox. Use checked and onCheckedChange for controlled state.
| Prop | Type | Default |
|---|---|---|
value | string | required |
checked | boolean | - |
onCheckedChange | (checked: boolean) => void | - |
disabled | boolean | - |
Group of mutually exclusive options. Use value and onValueChange for controlled state.
| Prop | Type | Default |
|---|---|---|
value | string | - |
onValueChange | (details: ValueChangeDetails) => void | - |
heading | string | - |
A single option in a radio group.
| Prop | Type | Default |
|---|---|---|
value | string | required |
disabled | boolean | - |
Groups related items. Use heading or MenuGroupLabel for a label.
| Prop | Type | Default |
|---|---|---|
heading | string | - |
Label for a group. Must be used inside MenuGroup.
Visual divider between groups of menu items.
A menu option with icon-above-text layout for quick actions. Use with flex to display multiple items horizontally.
| Prop | Type | Default |
|---|---|---|
value | string | required |
asChild | boolean | - |
disabled | boolean | - |
closeOnSelect | boolean | - |
onSelect | VoidFunction | - |
Submenu: wrap a nested Menu-like structure. MenuSubTrigger opens the submenu; MenuSubContent holds the nested items.
Optional keyboard shortcut hint displayed next to a menu item.
Optional arrow pointing toward the trigger.
| Prop | Type | Default |
|---|---|---|
className | string | - |
| Attribute | Default |
|---|---|
--arrow-background | var(--popover) |
--arrow-size | calc(1.5 * var(--spacing)) |
For a complete list of props, see the Ark UI documentation.
[
Previous page
Marquee ](/docs/components/marquee)[
Next page
Native Select ](/docs/components/native-select)
On This Page
InstallationAnatomyUsagePositioningExamplesNested MenuIconsShortcutsCheckboxesRadio GroupWith LinkWith Group LabelWith SeparatorQuick ItemsScrollableOpen a DialogDestructiveAPI ReferenceMenuMenuTriggerMenuContentMenuItemMenuCheckboxItemMenuRadioGroupMenuRadioItemMenuGroupMenuGroupLabelMenuSeparatorMenuQuickItemMenuSub / MenuSubTrigger / MenuSubContentMenuShortcutMenuArrow