HQReact UI
DocsThemes
  • Getting Started
  • Introduction
  • Installation
  • Client Side Routing
  • MCP Server
  • LLMs
  • Framework Guides
  • Nextjs
  • Laravel
  • Vite
  • Tanstack Start
  • Components
  • Buttons
  • Button
  • File Trigger
  • Toggle
  • Charts
  • Chart
  • Collections
  • Accordion
  • Bubble
  • Collapsible
  • Context Menu
  • Dropdown Menu
  • Grid List
  • Item
  • List Box
  • Message
  • Table
  • Tag Group
  • Tree
  • Colors
  • Color
  • Controls
  • Command
  • Kbd
  • Slider
  • Switch
  • Toolbar
  • Date And Time
  • Calendar
  • Range Calendar
  • Date Field
  • Date Picker
  • Date Range Picker
  • Time Field
  • Drag And Drop
  • Drop Zone
  • Forms
  • Field
  • Input
  • Combobox
  • Input Group
  • Checkbox
  • Radio
  • Select
  • Text Field
  • Number Field
  • Search Field
  • Input OTP
  • Layouts
  • Container
  • Navbar
  • Sidebar
  • Media
  • Avatar
  • Carousel
  • Navigation
  • Link
  • Breadcrumbs
  • Tabs
  • Pagination
  • Overlays
  • Dialog
  • Alert Dialog
  • Sheet
  • Popover
  • Tooltip
  • Statuses
  • Alert
  • Badge
  • Empty
  • Meter
  • Progress
  • Skeleton
  • Toastalpha
  • Surfaces
  • Card
  • Separator

On this page

Context Menu

Menu
context-menu-demo
Right click hereLong press here

Installation

CLI
Manual

npx shadcn add https://hq-ui.vercel.app/r/context-menu

Examples

Basic

A simple context menu with a few actions.

context-menu-basic
Right click hereLong press here

Submenu

Use ContextMenuSub to nest secondary actions.

context-menu-submenu
Right click hereLong press here

Shortcuts

Add ContextMenuShortcut to show keyboard hints.

context-menu-shortcuts
Right click hereLong press here

Groups

Group related actions and separate them with dividers.

context-menu-groups
Right click hereLong press here

Icons

Combine icons with labels for quick scanning.

context-menu-icons
Right click hereLong press here

Checkboxes

Use selectionMode="multiple" for toggles.

context-menu-checkboxes
Right click hereLong press here

Radio

Use selectionMode="single" for exclusive choices.

context-menu-radio
Right click hereLong press here

Destructive

Use variant="destructive" to style the menu item as destructive.

context-menu-destructive
Right click hereLong press here

Placement

Control submenu placement with the placement prop.

context-menu-sides
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 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.

Collapsible
Dropdown Menu

On this page

  • Installation
  • Examples
  • Basic
  • Submenu
  • Shortcuts
  • Groups
  • Icons
  • Checkboxes
  • Radio
  • Destructive
  • Placement
  • API Reference