Components
- Accordion
- Action Bar
- Action Toast
- Alert Banner
- Alert Dialog
- Alert
- Alphabet Index
- Amount Field
- Aspect Ratio
- Attachment
- Availability List
- Avatar
- Badge
- Bank Card
- Breadcrumb
- Bubble
- Button Group
- Button
- Calendar
- Camera Frame
- Card Design Picker
- Card Details
- Card Peek
- Card Stack
- Card
- Carousel
- Chart
- Chat Thread
- Checkbox
- Chip Group
- Choice Tile
- Code Block
- Code Dots
- Collapsible
- Combobox
- Command
- Context Menu
- Copy Field
- Countdown
- Country Select
- Data Table
- Date Field
- Date Picker
- Date Range Picker
- Dialog
- Direction
- Document Paper
- Drawer
- Dropdown Menu
- Empty
- Entity Avatar
- Field
- File Trigger
- File Upload Item
- Hover Card
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Key Value
- Keypad
- Label
- Live Region
- Marker
- Message Scroller
- Message
- Money Amount
- Native Select
- Number Field
- Pagination
- Percent Split Editor
- Phone Field
- Popover
- Progress
- QR Code
- Questionnaire
- Radio Group
- Range Histogram
- Rating
- Resizable
- Scroll Area
- Search Field
- Select
- Separator
- Share Bar
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Sortable List
- Spinner
- Status Timeline
- Step Header
- Steps List
- Swipe Row
- Switch
- Table
- Tabs
- Text Field
- Textarea
- Tier Ladder
- Toggle Group
- Toggle
- Token Search Field
- Tooltip
- Trace
- Transaction Row
- Usage Meter
Registry
Right click hereLong press here
"use client"
import { Pressable } from "react-aria-components"
Installation#
pnpm dlx shadcn@latest add @dots/context-menu
Usage#
import { Pressable } from "react-aria-components"
import {
ContextMenu,
ContextMenuItem,
ContextMenuTrigger,
} from "@/components/ui/context-menu"<ContextMenuTrigger>
<Pressable>
<div role="button">Right click here</div>
</Pressable>
<ContextMenu>
<ContextMenuItem>Profile</ContextMenuItem>
<ContextMenuItem>Billing</ContextMenuItem>
<ContextMenuItem>Team</ContextMenuItem>
<ContextMenuItem>Subscription</ContextMenuItem>
</ContextMenu>
</ContextMenuTrigger>Composition#
Use the following composition to build a ContextMenu:
ContextMenuTrigger
├── Pressable
└── ContextMenuContent
├── ContextMenuGroup
│ ├── ContextMenuLabel
│ ├── ContextMenuItem
│ └── ContextMenuItem
├── ContextMenuSeparator
├── ContextMenuGroup
│ ├── ContextMenuLabel
│ ├── ContextMenuItem
│ └── ContextMenuItem
└── ContextMenuSub
├── ContextMenuSubTrigger
└── ContextMenuSubContent
└── ContextMenuGroup
├── ContextMenuItem
└── ContextMenuItemBasic#
A simple context menu with a few actions.
Right click hereLong press here
"use client"
import { Pressable } from "react-aria-components"
Submenu#
Use ContextMenuSub to nest secondary actions.
Right click hereLong press here
"use client"
import { Pressable } from "react-aria-components"
Shortcuts#
Add ContextMenuShortcut to show keyboard hints.
Right click hereLong press here
"use client"
import { Pressable } from "react-aria-components"
Groups#
Group related actions and separate them with dividers.
Right click hereLong press here
"use client"
import { Pressable } from "react-aria-components"
Icons#
Combine icons with labels for quick scanning.
Right click hereLong press here
"use client"
import {
Checkboxes#
Use selectionMode="multiple" for toggles.
Right click hereLong press here
"use client"
import { useState } from "react"
Radio#
Use selectionMode="single" 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
"use client"
import { ArchiveIcon, PencilIcon, ShareIcon, TrashIcon } from "lucide-react"
Placement#
Control submenu placement with the placement prop.
Right click (top)Long press (top)
Right click (right)Long press (right)
Right click (bottom)Long press (bottom)
Right click (left)Long press (left)
"use client"
import { Pressable } from "react-aria-components"
API Reference#
See the React Aria documentation for more information.