# ContextMenuProps (@salmonui/buttons/menu)

> The ContextMenuProps interface of @salmonui/buttons/menu.

Canonical: https://salmonui.dev/docs/reference/buttons/menu/ContextMenuProps

```ts
import type { ContextMenuProps } from '@salmonui/buttons/menu';
```

Entry index: https://salmonui.dev/docs/reference/buttons/menu (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/buttons/menu.md).

## Reference

Kind: interface

```ts
interface ContextMenuProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
    readonly children?: ReactNode;
    readonly targetRef?: RefObject<HTMLElement | null>;
    readonly menu?: ReactNode;
    readonly items?: readonly MenuItemData[];
    readonly renderItem?: (item: MenuItemData) => ReactNode;
    readonly open?: boolean | undefined;
    readonly anchorPoint?: ContextMenuPoint | undefined;
    readonly onOpenChange?: (open: boolean, event: MenuOpenChangeEvent) => void;
    readonly onBeforeOpen?: (event: ContextMenuBeforeOpenEvent) => void;
    readonly onBeforeClose?: (event: ContextMenuBeforeCloseEvent) => void;
    readonly onAction?: (event: MenuActionEvent) => void;
    readonly submenuOpen?: MenuSubmenuOpen;
    readonly hoverDelay?: number;
    readonly disabled?: boolean;
    readonly container?: Element | null;
    readonly localeText?: Partial<ContextMenuLocaleText>;
    readonly classNames?: Partial<Record<ContextMenuPart, string>>;
    readonly styles?: Partial<Record<ContextMenuPart, CSSProperties>>;
    readonly ref?: Ref<HTMLDivElement>;
}
```

Members (19):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `children` | `readonly children?: ReactNode;` | optional | The target: right-click, long-press or Shift+F10 inside it opens the menu. |
| `targetRef` | `readonly targetRef?: RefObject<HTMLElement \| null>;` | optional | A target element the component does not wrap (wins over the wrapper). |
| `menu` | `readonly menu?: ReactNode;` | optional | A `<Menu>` element (its entries, `aria-label`, `onAction`, `className` and `style` apply to the popup) or the entries themselves. |
| `items` | `readonly items?: readonly MenuItemData[];` | optional | Data form of the entries. |
| `renderItem` | `readonly renderItem?: (item: MenuItemData) => ReactNode;` | optional |  |
| `open` | `readonly open?: boolean \| undefined;` | optional | Controlled open state. |
| `anchorPoint` | `readonly anchorPoint?: ContextMenuPoint \| undefined;` | optional | Where the menu opens while controlled (default: the pointer, or the target's start corner). |
| `onOpenChange` | `readonly onOpenChange?: (open: boolean, event: MenuOpenChangeEvent) => void;` | optional |  |
| `onBeforeOpen` | `readonly onBeforeOpen?: (event: ContextMenuBeforeOpenEvent) => void;` | optional | Cancellable; update the menu entries for `event.target` here. |
| `onBeforeClose` | `readonly onBeforeClose?: (event: ContextMenuBeforeCloseEvent) => void;` | optional | Cancellable. |
| `onAction` | `readonly onAction?: (event: MenuActionEvent) => void;` | optional | A chosen item (any level); `event.preventDefault()` keeps the menu open. |
| `submenuOpen` | `readonly submenuOpen?: MenuSubmenuOpen;` | optional |  |
| `hoverDelay` | `readonly hoverDelay?: number;` | optional |  |
| `disabled` | `readonly disabled?: boolean;` | optional | No menu opens; the browser menu shows. |
| `container` | `readonly container?: Element \| null;` | optional | Portal target (default `document.body`). |
| `localeText` | `readonly localeText?: Partial<ContextMenuLocaleText>;` | optional |  |
| `classNames` | `readonly classNames?: Partial<Record<ContextMenuPart, string>>;` | optional |  |
| `styles` | `readonly styles?: Partial<Record<ContextMenuPart, CSSProperties>>;` | optional |  |
| `ref` | `readonly ref?: Ref<HTMLDivElement>;` | optional | The wrapper element. |
