Redpanda UIRedpanda UI

Context Menu

Displays a menu to the user — such as a set of actions or functions — triggered by a button.

Made by shadcn

Installation

Loading component...

When to use

Use this decision tree to determine when to use the Context Menu component:

Usage

import {
  ContextMenu,
  ContextMenuContent,
  ContextMenuItem,
  ContextMenuTrigger,
} from "@/components/ui/context-menu"
<ContextMenu>
  <ContextMenuTrigger>Right click</ContextMenuTrigger>
  <ContextMenuContent>
    <ContextMenuItem>Profile</ContextMenuItem>
    <ContextMenuItem>Billing</ContextMenuItem>
    <ContextMenuItem>Team</ContextMenuItem>
    <ContextMenuItem>Subscription</ContextMenuItem>
  </ContextMenuContent>
</ContextMenu>

Examples

Loading component...

Checkbox items

Loading component...

Radio group

Loading component...

Grouped actions

Loading component...

Props

Keyboard interactions

KeyAction
Shift+F10 on the triggerOpens the context menu (standards-compliant keyboard equivalent of right-click).
ArrowUp / ArrowDownMoves between items. Wraps at the edges.
ArrowLeft / ArrowRightOpens / closes submenus.
Home / EndJumps to first / last item.
Enter / SpaceActivates the focused item.
EscapeCloses the menu.
Typing a characterTypeahead jumps to the next matching item.

Accessibility

  • The trigger region is marked role="group" and advertises the context menu via aria-haspopup="menu" — screen-reader users can reach the menu without a pointing device by pressing Shift+F10 while focused inside.
  • Menu items adopt role="menuitem" / menuitemcheckbox / menuitemradio, with roving focus inside the popup.
  • Use a visible outline / ring on the trigger region so keyboard users know where to press Shift+F10.
  • Keep context-menu-only actions non-essential — mirror every action elsewhere (toolbar, main menu) so pointer-restricted users are not blocked.

Credits

  • We use Base UI for the context-menu component.
  • We take our inspiration from Shadcn UI for the context-menu style.

Recent changes

  • patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested b…#133
  • minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
  • minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
  • majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
  • patchv0.3.1**Accordion** - `AccordionTrigger` now shows `cursor-pointer` on hover.#112
See full history →
Built by malinskibeniamin. The source code is available on GitHub.

On this page