ContextMenu
Right-click context menu. Wrap any element to attach a custom menu.
Default
Right-click this area
import { ContextMenu } from '@canarist/ui'
<ContextMenu
items={[
{ label: 'Open', onClick: () => openItem() },
{ label: 'Copy link', onClick: () => copyLink() },
{ label: 'Delete', destructive: true, onClick: () => deleteItem() },
]}
>
<div>Right-click this area</div>
</ContextMenu>Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | Element that triggers the context menu on right-click. |
| items | { label: string; onClick?: () => void; disabled?: boolean; destructive?: boolean }[] | — | Menu item definitions. destructive items render in red. |