Context Menu
A menu that opens on right-click, with actions, checkbox and radio items, labelled groups and destructive entries.
Parts
| Part | File | Does |
|---|---|---|
| ContextMenu | ContextMenu.vue | Groups all parts of the context menu, which opens on right-click. |
| ContextMenuCheckboxItem | ContextMenuCheckboxItem.vue | Lets the user switch an option on or off from the menu. |
| ContextMenuContent | ContextMenuContent.vue | Holds the items the context menu shows while open. |
| ContextMenuGroup | ContextMenuGroup.vue | Groups related items in the context menu. |
| ContextMenuItem | ContextMenuItem.vue | Holds one action the user can pick from the context menu. |
| ContextMenuLabel | ContextMenuLabel.vue | Labels a group of items in the context menu. |
| ContextMenuPortal | ContextMenuPortal.vue | Places the menu content above the rest of the page. |
| ContextMenuRadioGroup | ContextMenuRadioGroup.vue | Groups radio items so the user can pick exactly one. |
| ContextMenuRadioItem | ContextMenuRadioItem.vue | Lets the user choose one option from a group in the menu. |
| ContextMenuSeparator | ContextMenuSeparator.vue | Separates groups of items in the context menu. |
| ContextMenuShortcut | ContextMenuShortcut.vue | Shows the keyboard shortcut for a menu item. |
| ContextMenuSub | ContextMenuSub.vue | Groups a submenu trigger with the submenu it opens. |
| ContextMenuSubContent | ContextMenuSubContent.vue | Holds the items of a submenu while it is open. |
| ContextMenuSubTrigger | ContextMenuSubTrigger.vue | Opens a submenu from an item of the context menu. |
| ContextMenuTrigger | ContextMenuTrigger.vue | Marks the area where a right-click opens the context menu. |
Anatomy
<ContextMenu>
<ContextMenuTrigger />
<ContextMenuContent>
<ContextMenuGroup>
<ContextMenuLabel />
<ContextMenuItem>
<ContextMenuShortcut />
</ContextMenuItem>
<ContextMenuSub>
<ContextMenuSubTrigger />
<ContextMenuSubContent>
<ContextMenuRadioGroup>
<ContextMenuRadioItem />
</ContextMenuRadioGroup>
</ContextMenuSubContent>
</ContextMenuSub>
<ContextMenuCheckboxItem />
</ContextMenuGroup>
<ContextMenuSeparator />
<ContextMenuItem />
</ContextMenuContent>
</ContextMenu>Styling
All of Context Menu’s styles live in context-menu.json. New to styling in Frontic UI? How styling works →
Install
- npm packages
- @lucide/vue
- @vueuse/core
- class-variance-authority
- reka-ui
API reference
Groups all parts of the context menu, which opens on right-click.
Props 4
| Prop | Type | Default | |
|---|---|---|---|
| pressOpenDelay | number | 700 | |
| |||
| open | boolean | — | |
| |||
| dir | Direction | — | |
| |||
| modal | boolean | true | |
| |||
Events 1
| Event | Payload | |
|---|---|---|
| update:open | payload: boolean | |
| ||