Back to skills
SKILL.md
Context Menu
ASecurityRight-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
Works with
Security analysis
100/100npx -y skills add reaviz/skills --skill context-menu --agent claude-codeAre you the author of Context Menu?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/reaviz-context-menu)# 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
Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.