@neynar/ui
Version:
React UI component library built on shadcn/ui and Tailwind CSS
49 lines (39 loc) • 1.18 kB
Markdown
# ContextMenuPortal
**Type**: component
ContextMenuPortal - Portal container for menu content Renders menu content in a portal to ensure proper layering and positioning. Useful for controlling where menu content is rendered in the DOM tree, especially important for sub-menus and complex layouts.
## JSX Usage
```jsx
import { ContextMenuPortal } from '@neynar/ui';
<ContextMenuPortal
container={value}
>
{/* Your content here */}
</ContextMenuPortal>
```
## Component Props
### container
- **Type**: `HTMLElement`
- **Required**: No
- **Description**: Custom container element to portal content into
### children
- **Type**: `React.ReactNode`
- **Required**: Yes
- **Description**: The menu content to render in the portal
## Examples
### Example 1
```tsx
<ContextMenuPortal>
<ContextMenuSubContent>
<ContextMenuItem>Portal Item</ContextMenuItem>
</ContextMenuSubContent>
</ContextMenuPortal>
```
### Example 2
```tsx
// Portal into specific container
<ContextMenuPortal container={document.getElementById('menu-container')}>
<ContextMenuContent>
<ContextMenuItem>Custom Portal Item</ContextMenuItem>
</ContextMenuContent>
</ContextMenuPortal>
```