@neynar/ui
Version:
React UI component library built on shadcn/ui and Tailwind CSS
53 lines (42 loc) • 1.29 kB
Markdown
# ContextMenuTrigger
**Type**: component
ContextMenuTrigger - The element that triggers the context menu Wraps any element to make it respond to right-click or long-press events. The trigger element should provide visual feedback about its interactive nature. Uses the `asChild` pattern to merge props with child elements for composition.
## JSX Usage
```jsx
import { ContextMenuTrigger } from '@neynar/ui';
<ContextMenuTrigger
asChild={true}
disabled={true}
>
{/* Your content here */}
</ContextMenuTrigger>
```
## Component Props
### asChild
- **Type**: `boolean`
- **Required**: No
- **Description**: Merges props with child element instead of rendering wrapper
### disabled
- **Type**: `boolean`
- **Required**: No
- **Description**: Prevents context menu from opening when trigger is activated
### children
- **Type**: `React.ReactNode`
- **Required**: Yes
- **Description**: The element that should respond to right-click events
## Examples
### Example 1
```tsx
<ContextMenuTrigger>
<Button variant="outline">Right-click me</Button>
</ContextMenuTrigger>
```
### Example 2
```tsx
// With asChild for direct prop merging
<ContextMenuTrigger asChild>
<div className="p-4 border rounded cursor-pointer">
Right-click target area
</div>
</ContextMenuTrigger>
```