Skip to content
Back to skills

Context Menu

ASecurity

Right-click context menu using ConnectedOverlay (Floating UI). Supports focus trapping, global menu state (only one open at a time), and auto-close on click.

  • 4 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 27, 2026
developmenttypescriptreactnode

Works with

  • cursor
  • cli

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add reaviz/skills --skill context-menu --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Context Menu?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Context Menu
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/reaviz-context-menu/badge)](https://www.skillsdirectory.com/skills/reaviz-context-menu)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# ContextMenu

Right-click context menu using ConnectedOverlay (Floating UI). Supports focus trapping, global menu state (only one open at a time), and auto-close on click.

## Import

```tsx
import { ContextMenu } from 'reablocks';
```

## ContextMenu Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `children` | `ReactNode` | — | Trigger element (right-click target) |
| `content` | `ReactNode \| (({ close, closeAll }) => ReactNode)` | — | Menu content |
| `disabled` | `boolean` | — | Disable the context menu |
| `autofocus` | `boolean` | `true` | Focus trap on open |
| `autoClose` | `boolean` | `true` | Close on content click |
| `closeOnEscape` | `boolean` | `true` | Close on Escape key |
| `closeOnBodyClick` | `boolean` | `true` | Close on outside click |
| `triggerClassName` | `string` | — | CSS class for the trigger wrapper |
| `triggerOpenClassName` | `string` | — | CSS class when menu is open |
| `theme` | `ContextMenuTheme` | — | Per-instance theme override |

Also accepts ConnectedOverlay props (except `open`).

## Basic Usage

```tsx
<ContextMenu content={
  <Card>
    <List>
      <ListItem onClick={() => copy()}>Copy</ListItem>
      <ListItem onClick={() => paste()}>Paste</ListItem>
      <ListItem onClick={() => del()}>Delete</ListItem>
    </List>
  </Card>
}>
  <div>Right-click me</div>
</ContextMenu>
```

## With Close Control

Content can be a render function receiving `close` and `closeAll`:

```tsx
<ContextMenu content={({ close, closeAll }) => (
  <Card>
    <List>
      <ListItem onClick={() => { action(); close(); }}>Action</ListItem>
      <ListItem onClick={closeAll}>Close All Menus</ListItem>
    </List>
  </Card>
)}>
  <div>Right-click me</div>
</ContextMenu>
```

## ContextMenuTheme Interface

```typescript
interface ContextMenuTheme {
  enabled: string;  // Cursor style when enabled (cursor-context-menu)
}
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.