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
- Data Table
- Date Picker
- Dialog
- Direction
- Drawer
- Dropdown Menu
- Empty
- Field
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Marker
- Message
- Message Scroller
- Native Select
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
- Typography
Get Started
@shadcn/react
@shadcn/helpers
Utilities
Right click hereLong press here
"use client"
import { Pressable } from "react-aria-components"Installation#
pnpm dlx shadcn@latest add 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"RTL#
To enable RTL support in shadcn/ui, see the RTL configuration guide.
انقر بزر الماوس الأيمن هنااضغط مطولاً هنا
"use client"
import * as React from "react"Use placement="end" to place the menu on the logical end side of the trigger.
<ContextMenuTrigger>
<Pressable>
<div role="button">Right click here</div>
</Pressable>
<ContextMenu placement="end">
<ContextMenuItem>Profile</ContextMenuItem>
<ContextMenuItem>Billing</ContextMenuItem>
<ContextMenuItem>Team</ContextMenuItem>
<ContextMenuItem>Subscription</ContextMenuItem>
</ContextMenu>
</ContextMenuTrigger>API Reference#
See the React Aria documentation for more information.
Deploy your shadcn/ui app on Vercel
Trusted by OpenAI, Sonos, Adobe, and more.
Vercel provides tools and infrastructure to deploy apps and features at scale.
Deploy to Vercel