Context Menu
Shows actions for an item from a right-click or long-press.
Right click here
Installation
Install Context Menu from Oros with shadcn CLI 4.13.0.
pnpm dlx shadcn@4.13.0 add @oros/context-menuUsage
import {
ContextMenu,
ContextMenuTrigger,
ContextMenuContent,
ContextMenuItem,
ContextMenuCheckboxItem,
ContextMenuRadioItem,
} from "@/components/ui/context-menu"Open the Source tab in the preview for a complete working example.
Anatomy
| Export | Responsibility |
|---|---|
| ContextMenu | The root component that owns the primary structure and state. |
| ContextMenuTrigger | Controls opening, selection, or disclosure behavior. |
| ContextMenuContent | Contains the primary visible content. |
| ContextMenuItem | Represents one option or repeated child. |
| ContextMenuCheckboxItem | Represents one option or repeated child. |
| ContextMenuRadioItem | Represents one option or repeated child. |
| ContextMenuLabel | Provides a visible label for its related control or value. |
| ContextMenuSeparator | Visually and semantically separates related groups. |
| ContextMenuShortcut | A composable part of the component anatomy. |
| ContextMenuGroup | Groups related items into one logical set. |
| ContextMenuPortal | Moves overlay content to a stable document layer. |
| ContextMenuSub | A composable part of the component anatomy. |
| ContextMenuSubContent | Contains the primary visible content. |
| ContextMenuSubTrigger | Controls opening, selection, or disclosure behavior. |
| ContextMenuRadioGroup | Groups related items into one logical set. |
API Reference
Context Menu exports 15 named entries. Component exports accept the props of their underlying HTML element or Base UI component, plus an optional className, unless the source defines a more focused type.
ContextMenuComponentContextMenuTriggerComponentContextMenuContentComponentContextMenuItemComponentContextMenuCheckboxItemComponentContextMenuRadioItemComponentContextMenuLabelComponentContextMenuSeparatorComponentContextMenuShortcutComponentContextMenuGroupComponentContextMenuPortalComponentContextMenuSubComponentContextMenuSubContentComponentContextMenuSubTriggerComponentContextMenuRadioGroupComponent
Accessibility
- Context Menu inherits focus management and keyboard support from Base UI; keep the provided trigger and content parts together.
- Give icon-only triggers an accessible name, retain visible focus styles, and verify Escape and focus-return behavior in the final composition.
Source
Context Menu uses the standard shadcn API and is distributed through Oros. Installing it adds the component source and required dependencies to your app. The Source tab above shows a complete usage example.