Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Desktop Window
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Frame
- Heading
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Live Waveform
- Marker
- Menubar
- Message
- Message Scroller
- Meter
- Meter Ring
- Native Select
- Navigation Menu
- NumberCount
- Pagination
- Popover
- Progress
- Progress Ring
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Timeline
- Toast
- Toggle
- Toggle Group
- Tooltip
Compositions
Utilities
Right click hereLong press here
import {
ContextMenu,
ContextMenuCheckboxItem,Installation#
bunx --bun shadcn@latest add @ondo-ui/context-menu
Usage#
import {
ContextMenu,
ContextMenuContent,
ContextMenuItem,
ContextMenuTrigger,
} from "@/components/ui/context-menu"<ContextMenu>
<ContextMenuTrigger>Right click here</ContextMenuTrigger>
<ContextMenuContent>
<ContextMenuItem>Profile</ContextMenuItem>
<ContextMenuItem>Billing</ContextMenuItem>
<ContextMenuItem>Team</ContextMenuItem>
<ContextMenuItem>Subscription</ContextMenuItem>
</ContextMenuContent>
</ContextMenu>Composition#
Use the following composition to build a ContextMenu:
ContextMenu
├── ContextMenuTrigger
└── ContextMenuContent
├── ContextMenuGroup
│ ├── ContextMenuLabel
│ ├── ContextMenuItem
│ └── ContextMenuItem
├── ContextMenuSeparator
├── ContextMenuGroup
│ ├── ContextMenuLabel
│ ├── ContextMenuCheckboxItem
│ └── ContextMenuCheckboxItem
├── ContextMenuSeparator
├── ContextMenuGroup
│ ├── ContextMenuLabel
│ └── ContextMenuRadioGroup
│ ├── ContextMenuRadioItem
│ └── ContextMenuRadioItem
└── ContextMenuSub
├── ContextMenuSubTrigger
└── ContextMenuSubContent
└── ContextMenuGroup
├── ContextMenuItem
└── ContextMenuItemExamples#
Basic#
A simple context menu with a few actions.
Right click hereLong press here
import {
ContextMenu,
ContextMenuContent,Submenu#
Use ContextMenuSub to nest secondary actions.
Right click hereLong press here
import {
ContextMenu,
ContextMenuContent,Shortcuts#
Add ContextMenuShortcut to show keyboard hints.
Right click hereLong press here
import {
ContextMenu,
ContextMenuContent,Groups#
Group related actions and separate them with dividers.
Right click hereLong press here
import {
ContextMenu,
ContextMenuContent,Icons#
Combine icons with labels for quick scanning.
Right click hereLong press here
import {
IconClipboardCopy,
IconCopy,Checkboxes#
Use ContextMenuCheckboxItem for toggles.
Right click hereLong press here
import {
ContextMenu,
ContextMenuCheckboxItem,Radio#
Use ContextMenuRadioItem for exclusive choices.
Right click hereLong press here
"use client"
import * as React from "react"Destructive#
Use variant="destructive" to style the menu item as destructive.
Right click hereLong press here
import { IconPencil, IconShare, IconTrash } from "@tabler/icons-react"
import {Sides#
Control submenu placement with side and align props.
Right click (top)Long press (top)
Right click (right)Long press (right)
Right click (bottom)Long press (bottom)
Right click (left)Long press (left)
import {
ContextMenu,
ContextMenuContent,API reference#
The component wraps Base UI Context Menu and accepts all of its props.