# @salmonui/buttons/menu API reference

> 52 exported symbols of @salmonui/buttons/menu: 14 functions, 25 interfaces, 11 types and 2 constants.

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

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

## Functions

### ContextMenu

Kind: function

Page: https://salmonui.dev/docs/reference/buttons/menu/ContextMenu

```ts
function ContextMenu(props: ContextMenuProps): ReactElement | null;
```

Opens a menu at the pointer for its target. `<ContextMenu menu={<Menu>...</Menu>}>{target}</ContextMenu>`,
or `targetRef` for an element it does not wrap.

### Menu

Kind: function

Page: https://salmonui.dev/docs/reference/buttons/menu/Menu

```ts
function Menu(props: MenuProps): ReactElement;
```

A menu list rendered in place (`role="menu"`, one tab stop with roving
focus). `MenuButton` and `SplitButton` render the same list in a popup.

### MenuButton

Kind: function

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuButton

```ts
function MenuButton(props: MenuButtonProps): ReactElement;
```

APG Menu Button: a `Button` that opens a menu (`aria-haspopup="menu"`,
`aria-expanded`, `aria-controls` while open). Enter, Space and ArrowDown
open it on the first item, ArrowUp on the last.

### MenuCheckboxItem

Kind: function

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuCheckboxItem

```ts
function MenuCheckboxItem(props: MenuCheckboxItemProps): ReactElement;
```

`role="menuitemcheckbox"` with the `checked` triad.

### MenuGroup

Kind: function

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuGroup

```ts
function MenuGroup(props: MenuGroupProps): ReactElement;
```

`role="group"` of items with an optional visible label.

### MenuItem

Kind: function

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuItem

```ts
function MenuItem(props: MenuItemProps): ReactElement;
```

### MenuRadioGroup

Kind: function

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuRadioGroup

```ts
function MenuRadioGroup(props: MenuRadioGroupProps): ReactElement;
```

`role="group"` of `MenuRadioItem`s with the `value` triad.

### MenuRadioItem

Kind: function

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuRadioItem

```ts
function MenuRadioItem(props: MenuRadioItemProps): ReactElement;
```

`role="menuitemradio"` inside a `MenuRadioGroup`.

### MenuSeparator

Kind: function

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuSeparator

```ts
function MenuSeparator(props: MenuSeparatorProps): ReactElement;
```

`role="separator"`; never focusable.

### Menubar

Kind: function

Page: https://salmonui.dev/docs/reference/buttons/menu/Menubar

```ts
function Menubar(props: MenubarProps): ReactElement;
```

APG Menubar: `role="menubar"`, horizontal, one tab stop.

### MenubarItem

Kind: function

Page: https://salmonui.dev/docs/reference/buttons/menu/MenubarItem

```ts
function MenubarItem(props: MenubarItemProps): ReactElement;
```

A top-level command or link without a menu.

### MenubarMenu

Kind: function

Page: https://salmonui.dev/docs/reference/buttons/menu/MenubarMenu

```ts
function MenubarMenu(props: MenubarMenuProps): ReactElement;
```

A top-level item that opens a menu (`aria-haspopup="menu"`, `aria-expanded`).

### SplitButton

Kind: function

Page: https://salmonui.dev/docs/reference/buttons/menu/SplitButton

```ts
function SplitButton(props: SplitButtonProps): ReactElement;
```

A primary `Button` and a menu trigger joined in one group: two tab stops;
the trigger follows the Menu Button keys and Alt+ArrowDown on the primary
part opens the menu too. `tone`, `variant`, `size` and `disabled` apply to
both parts; other DOM props and `onClick` go to the primary button.

### Submenu

Kind: function

Page: https://salmonui.dev/docs/reference/buttons/menu/Submenu

```ts
function Submenu(props: SubmenuProps): ReactElement;
```

An item that opens a nested menu: ArrowRight (ArrowLeft in RTL), Enter or
Space open it and focus its first item; ArrowLeft or Escape close it; the
pointer opens it after a 200 ms rest.

## Interfaces

### ContextMenuBeforeCloseEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/ContextMenuBeforeCloseEvent

```ts
interface ContextMenuBeforeCloseEvent {
    readonly reason: MenuOpenChangeReason;
    readonly source: MenuSource;
    readonly defaultPrevented: boolean;
    preventDefault(): void;
}
```

`onBeforeClose` event; `preventDefault()` keeps the menu open.

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `reason` | `readonly reason: MenuOpenChangeReason;` |  |  |
| `source` | `readonly source: MenuSource;` |  |  |
| `defaultPrevented` | `readonly defaultPrevented: boolean;` |  |  |
| `preventDefault` | `preventDefault(): void;` |  |  |

### ContextMenuBeforeOpenEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/ContextMenuBeforeOpenEvent

```ts
interface ContextMenuBeforeOpenEvent {
    readonly target: Element;
    readonly point: ContextMenuPoint;
    readonly source: ContextMenuSource;
    readonly defaultPrevented: boolean;
    preventDefault(): void;
}
```

`onBeforeOpen` event; `preventDefault()` keeps the menu closed (and the browser menu shows).

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `target` | `readonly target: Element;` |  | The element the event happened on (the deepest target; filter with `closest`). |
| `point` | `readonly point: ContextMenuPoint;` |  |  |
| `source` | `readonly source: ContextMenuSource;` |  |  |
| `defaultPrevented` | `readonly defaultPrevented: boolean;` |  |  |
| `preventDefault` | `preventDefault(): void;` |  |  |

### ContextMenuLocaleText

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/ContextMenuLocaleText

```ts
interface ContextMenuLocaleText {
    readonly label: string;
}
```

Members (1):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `label` | `readonly label: string;` |  | Accessible name of the menu when the `Menu` element has none. |

### ContextMenuPoint

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/ContextMenuPoint

```ts
interface ContextMenuPoint {
    readonly x: number;
    readonly y: number;
}
```

Viewport coordinates in CSS px (`clientX` / `clientY`).

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `x` | `readonly x: number;` |  |  |
| `y` | `readonly y: number;` |  |  |

### ContextMenuProps

Kind: interface

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

```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. |

### MenuActionEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuActionEvent

```ts
interface MenuActionEvent {
    readonly id: string;
    readonly item: MenuItemData | undefined;
    readonly source: MenuSource;
    readonly defaultPrevented: boolean;
    preventDefault(): void;
}
```

`onAction` event: a chosen item. `preventDefault()` keeps the menu open (and stops link navigation).

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `id` | `readonly id: string;` |  |  |
| `item` | `readonly item: MenuItemData \| undefined;` |  | The data entry when the menu was built from `items`. |
| `source` | `readonly source: MenuSource;` |  |  |
| `defaultPrevented` | `readonly defaultPrevented: boolean;` |  |  |
| `preventDefault` | `preventDefault(): void;` |  |  |

### MenuButtonMenuProps

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuButtonMenuProps

```ts
interface MenuButtonMenuProps {
    readonly menu?: ReactNode;
    readonly items?: readonly MenuItemData[];
    readonly renderItem?: (item: MenuItemData) => ReactNode;
    readonly open?: boolean | undefined;
    readonly defaultOpen?: boolean;
    readonly onOpenChange?: (open: boolean, event: MenuOpenChangeEvent) => void;
    readonly onAction?: (event: MenuActionEvent) => void;
    readonly placement?: MenuPlacement;
    readonly container?: Element | null;
    readonly submenuOpen?: MenuSubmenuOpen;
    readonly hoverDelay?: number;
}
```

Members (11):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `menu` | `readonly menu?: ReactNode;` | optional | Menu entries as JSX (`MenuItem`, `MenuCheckboxItem`, `MenuRadioGroup`, `MenuGroup`, `MenuSeparator`, `Submenu`). Wins over `items`. |
| `items` | `readonly items?: readonly MenuItemData[];` | optional | Data form of the menu entries. |
| `renderItem` | `readonly renderItem?: (item: MenuItemData) => ReactNode;` | optional | Content of each `items` entry (default: its `label`). |
| `open` | `readonly open?: boolean \| undefined;` | optional |  |
| `defaultOpen` | `readonly defaultOpen?: boolean;` | optional | Applied after hydration (server and client markup stay identical). |
| `onOpenChange` | `readonly onOpenChange?: (open: boolean, event: MenuOpenChangeEvent) => void;` | optional |  |
| `onAction` | `readonly onAction?: (event: MenuActionEvent) => void;` | optional | A chosen item (any level); `event.preventDefault()` keeps the menu open. |
| `placement` | `readonly placement?: MenuPlacement;` | optional | Default `'bottom-start'`; flips and shifts to stay in the viewport; logical (mirrored in RTL). |
| `container` | `readonly container?: Element \| null;` | optional | Portal target (default: the trigger's `document.body`). |
| `submenuOpen` | `readonly submenuOpen?: MenuSubmenuOpen;` | optional | Submenus open after a pointer rest of `hoverDelay` ms (default `'hover'`) or on click only. |
| `hoverDelay` | `readonly hoverDelay?: number;` | optional | Hover intent of submenus in ms (default 200). |

### MenuChangeEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuChangeEvent

```ts
interface MenuChangeEvent {
    readonly source: MenuSource;
    readonly reason: 'action';
}
```

Second argument of `onCheckedChange` / `onValueChange` in menus (frozen).

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `source` | `readonly source: MenuSource;` |  |  |
| `reason` | `readonly reason: 'action';` |  |  |

### MenuCheckboxItemProps

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuCheckboxItemProps

```ts
interface MenuCheckboxItemProps extends ItemCommonProps {
    readonly id?: string;
    readonly checked?: boolean;
    readonly defaultChecked?: boolean;
    readonly onCheckedChange?: (checked: boolean, event: MenuChangeEvent) => void;
    readonly onAction?: (event: MenuActionEvent) => void;
}
```

Members (13):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `id` | `readonly id?: string;` | optional | Item key reported in `onAction` (optional). |
| `checked` | `readonly checked?: boolean;` | optional |  |
| `defaultChecked` | `readonly defaultChecked?: boolean;` | optional |  |
| `onCheckedChange` | `readonly onCheckedChange?: (checked: boolean, event: MenuChangeEvent) => void;` | optional |  |
| `onAction` | `readonly onAction?: (event: MenuActionEvent) => void;` | optional | Runs after the toggle; `event.preventDefault()` keeps the menu open. Space always keeps it open. |
| `children` | `children?: ReactNode;` | optional, inherited |  |
| `icon` | `icon?: ReactNode;` | optional, inherited | Decorative leading icon (`aria-hidden`). |
| `disabled` | `disabled?: boolean;` | optional, inherited | Skipped by arrow keys and typeahead; `aria-disabled="true"`. |
| `textValue` | `textValue?: string;` | optional, inherited | Typeahead text when the children are not plain text. |
| `className` | `className?: string;` | optional, inherited |  |
| `style` | `style?: CSSProperties;` | optional, inherited |  |
| `ref` | `ref?: Ref<HTMLElement>;` | optional, inherited |  |
| `onClick` | `onClick?: ((event: MouseEvent<HTMLElement, MouseEvent>) => void);` | optional, inherited |  |

### MenuGroupProps

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuGroupProps

```ts
interface MenuGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'role'> {
    readonly label?: ReactNode;
    readonly children?: ReactNode;
    readonly ref?: Ref<HTMLDivElement>;
}
```

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `label` | `readonly label?: ReactNode;` | optional | Visible group label (also the accessible name through `aria-labelledby`). |
| `children` | `readonly children?: ReactNode;` | optional |  |
| `ref` | `readonly ref?: Ref<HTMLDivElement>;` | optional |  |

### MenuItemData

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuItemData

```ts
interface MenuItemData {
    readonly type?: 'item' | 'separator' | 'group';
    readonly id?: string;
    readonly label?: ReactNode;
    readonly textValue?: string;
    readonly icon?: ReactNode;
    readonly disabled?: boolean;
    readonly href?: string;
    readonly target?: string;
    readonly title?: string;
    readonly items?: readonly MenuItemData[];
}
```

Data form of a menu entry (`items` prop). `type` defaults to `'item'`; an
item with `items` is a submenu; `'group'` is a labelled group of `items`.

Members (10):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `type` | `readonly type?: 'item' \| 'separator' \| 'group';` | optional |  |
| `id` | `readonly id?: string;` | optional | Stable item key, reported in `onAction` (required for items). |
| `label` | `readonly label?: ReactNode;` | optional |  |
| `textValue` | `readonly textValue?: string;` | optional | Typeahead text when `label` is not plain text. |
| `icon` | `readonly icon?: ReactNode;` | optional |  |
| `disabled` | `readonly disabled?: boolean;` | optional |  |
| `href` | `readonly href?: string;` | optional | Renders the item as a link (`<a role="menuitem">`). |
| `target` | `readonly target?: string;` | optional |  |
| `title` | `readonly title?: string;` | optional |  |
| `items` | `readonly items?: readonly MenuItemData[];` | optional | Submenu entries (type `'item'`) or group entries (type `'group'`). |

### MenuItemProps

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuItemProps

```ts
interface MenuItemProps extends ItemCommonProps {
    readonly id: string;
    readonly item?: MenuItemData | undefined;
    readonly href?: string | undefined;
    readonly target?: string | undefined;
    readonly onAction?: (event: MenuActionEvent) => void;
    readonly render?: (props: MenuItemRenderProps) => ReactElement;
}
```

Members (14):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `id` | `readonly id: string;` |  | Stable item key reported in `onAction` (`data-item-id`; not the DOM id). |
| `item` | `readonly item?: MenuItemData \| undefined;` | optional | The data entry reported in `onAction` (set by the `items` form). |
| `href` | `readonly href?: string \| undefined;` | optional | Renders `<a role="menuitem" href>`. |
| `target` | `readonly target?: string \| undefined;` | optional |  |
| `onAction` | `readonly onAction?: (event: MenuActionEvent) => void;` | optional | This item was chosen; `event.preventDefault()` keeps the menu open. Runs before the menu's `onAction`. |
| `render` | `readonly render?: (props: MenuItemRenderProps) => ReactElement;` | optional | Custom element (router links): `render={(props) => <Link {...props} to="/x" />}`. |
| `children` | `children?: ReactNode;` | optional, inherited |  |
| `icon` | `icon?: ReactNode;` | optional, inherited | Decorative leading icon (`aria-hidden`). |
| `disabled` | `disabled?: boolean;` | optional, inherited | Skipped by arrow keys and typeahead; `aria-disabled="true"`. |
| `textValue` | `textValue?: string;` | optional, inherited | Typeahead text when the children are not plain text. |
| `className` | `className?: string;` | optional, inherited |  |
| `style` | `style?: CSSProperties;` | optional, inherited |  |
| `ref` | `ref?: Ref<HTMLElement>;` | optional, inherited |  |
| `onClick` | `onClick?: ((event: MouseEvent<HTMLElement, MouseEvent>) => void);` | optional, inherited |  |

### MenuOpenChangeEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuOpenChangeEvent

```ts
interface MenuOpenChangeEvent {
    readonly source: MenuSource;
    readonly reason: MenuOpenChangeReason;
}
```

Second argument of `onOpenChange` (frozen).

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `source` | `readonly source: MenuSource;` |  |  |
| `reason` | `readonly reason: MenuOpenChangeReason;` |  |  |

### MenuProps

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuProps

```ts
interface MenuProps extends DivProps {
    readonly children?: ReactNode;
    readonly items?: readonly MenuItemData[];
    readonly renderItem?: (item: MenuItemData) => ReactNode;
    readonly onAction?: (event: MenuActionEvent) => void;
    readonly submenuOpen?: MenuSubmenuOpen;
    readonly hoverDelay?: number;
    readonly className?: string;
    readonly style?: CSSProperties;
    readonly ref?: Ref<HTMLDivElement>;
}
```

Members (9):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `children` | `readonly children?: ReactNode;` | optional | JSX entries (`MenuItem`, `MenuCheckboxItem`, `MenuRadioGroup`, `MenuGroup`, `MenuSeparator`, `Submenu`). Win over `items`. |
| `items` | `readonly items?: readonly MenuItemData[];` | optional | Data form of the entries. |
| `renderItem` | `readonly renderItem?: (item: MenuItemData) => ReactNode;` | optional | Content of each `items` entry (default: its `label`). |
| `onAction` | `readonly onAction?: (event: MenuActionEvent) => void;` | optional | A chosen item (any level). |
| `submenuOpen` | `readonly submenuOpen?: MenuSubmenuOpen;` | optional | Submenus open after a pointer rest of `hoverDelay` ms (default `'hover'`) or on click only. |
| `hoverDelay` | `readonly hoverDelay?: number;` | optional | Hover intent of submenus in ms (default 200). |
| `className` | `readonly className?: string;` | optional |  |
| `style` | `readonly style?: CSSProperties;` | optional |  |
| `ref` | `readonly ref?: Ref<HTMLDivElement>;` | optional | The `role="menu"` element. |

### MenuRadioGroupProps

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuRadioGroupProps

```ts
interface MenuRadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'defaultValue' | 'role'> {
    readonly value?: string | null;
    readonly defaultValue?: string | null;
    readonly onValueChange?: (value: string, event: MenuChangeEvent) => void;
    readonly label?: ReactNode;
    readonly children?: ReactNode;
    readonly ref?: Ref<HTMLDivElement>;
}
```

Members (6):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `value` | `readonly value?: string \| null;` | optional |  |
| `defaultValue` | `readonly defaultValue?: string \| null;` | optional |  |
| `onValueChange` | `readonly onValueChange?: (value: string, event: MenuChangeEvent) => void;` | optional |  |
| `label` | `readonly label?: ReactNode;` | optional | Visible group label (also the accessible name). |
| `children` | `readonly children?: ReactNode;` | optional |  |
| `ref` | `readonly ref?: Ref<HTMLDivElement>;` | optional |  |

### MenuRadioItemProps

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuRadioItemProps

```ts
interface MenuRadioItemProps extends ItemCommonProps {
    readonly value: string;
    readonly id?: string;
    readonly onAction?: (event: MenuActionEvent) => void;
}
```

Members (11):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `value` | `readonly value: string;` |  |  |
| `id` | `readonly id?: string;` | optional | Item key reported in `onAction` (default: `value`). |
| `onAction` | `readonly onAction?: (event: MenuActionEvent) => void;` | optional | Runs after the selection; `event.preventDefault()` keeps the menu open. Space always keeps it open. |
| `children` | `children?: ReactNode;` | optional, inherited |  |
| `icon` | `icon?: ReactNode;` | optional, inherited | Decorative leading icon (`aria-hidden`). |
| `disabled` | `disabled?: boolean;` | optional, inherited | Skipped by arrow keys and typeahead; `aria-disabled="true"`. |
| `textValue` | `textValue?: string;` | optional, inherited | Typeahead text when the children are not plain text. |
| `className` | `className?: string;` | optional, inherited |  |
| `style` | `style?: CSSProperties;` | optional, inherited |  |
| `ref` | `ref?: Ref<HTMLElement>;` | optional, inherited |  |
| `onClick` | `onClick?: ((event: MouseEvent<HTMLElement, MouseEvent>) => void);` | optional, inherited |  |

### MenuSeparatorProps

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuSeparatorProps

```ts
interface MenuSeparatorProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'role'> {
    readonly ref?: Ref<HTMLDivElement>;
}
```

Members (1):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `ref` | `readonly ref?: Ref<HTMLDivElement>;` | optional |  |

### MenubarBeforeValueChangeEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenubarBeforeValueChangeEvent

```ts
interface MenubarBeforeValueChangeEvent extends MenubarValueChangeEvent {
    readonly value: string | null;
    readonly previousValue: string | null;
    readonly defaultPrevented: boolean;
    preventDefault(): void;
}
```

`onBeforeValueChange`; `preventDefault()` keeps the current menu (or none) open.

Members (6):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `value` | `readonly value: string \| null;` |  | The proposed open menu, or `null` to close. |
| `previousValue` | `readonly previousValue: string \| null;` |  |  |
| `defaultPrevented` | `readonly defaultPrevented: boolean;` |  |  |
| `preventDefault` | `preventDefault(): void;` |  |  |
| `reason` | `reason: MenubarValueChangeReason;` | inherited |  |
| `source` | `source: MenuSource;` | inherited |  |

### MenubarItemProps

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenubarItemProps

```ts
interface MenubarItemProps extends TopItemDomProps {
    readonly id: string;
    readonly children?: ReactNode;
    readonly icon?: ReactNode;
    readonly disabled?: boolean;
    readonly textValue?: string;
    readonly href?: string;
    readonly target?: string;
    readonly onAction?: (event: MenuActionEvent) => void;
    readonly render?: (props: MenuItemRenderProps) => ReactElement;
    readonly className?: string;
    readonly style?: CSSProperties;
    readonly ref?: Ref<HTMLElement>;
}
```

Members (12):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `id` | `readonly id: string;` |  | Stable key reported in `onAction`. |
| `children` | `readonly children?: ReactNode;` | optional |  |
| `icon` | `readonly icon?: ReactNode;` | optional |  |
| `disabled` | `readonly disabled?: boolean;` | optional |  |
| `textValue` | `readonly textValue?: string;` | optional |  |
| `href` | `readonly href?: string;` | optional | Renders `<a role="menuitem" href>`. |
| `target` | `readonly target?: string;` | optional |  |
| `onAction` | `readonly onAction?: (event: MenuActionEvent) => void;` | optional | Runs before the bar's `onAction`; `event.preventDefault()` stops link navigation. |
| `render` | `readonly render?: (props: MenuItemRenderProps) => ReactElement;` | optional | Custom element (router links): `render={(props) => <Link {...props} to="/help" />}`; spread every prop. |
| `className` | `readonly className?: string;` | optional |  |
| `style` | `readonly style?: CSSProperties;` | optional |  |
| `ref` | `readonly ref?: Ref<HTMLElement>;` | optional |  |

### MenubarLocaleText

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenubarLocaleText

```ts
interface MenubarLocaleText {
    readonly scrollBackward: string;
    readonly scrollForward: string;
}
```

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `scrollBackward` | `readonly scrollBackward: string;` |  | Title of the scroll indicator at the start (`overflow: 'scroll'`). |
| `scrollForward` | `readonly scrollForward: string;` |  |  |

### MenubarMenuProps

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenubarMenuProps

```ts
interface MenubarMenuProps extends TopItemDomProps {
    readonly value?: string;
    readonly label: ReactNode;
    readonly icon?: ReactNode;
    readonly disabled?: boolean;
    readonly textValue?: string;
    readonly children?: ReactNode;
    readonly items?: readonly MenuItemData[];
    readonly renderItem?: (item: MenuItemData) => ReactNode;
    readonly id?: string;
    readonly className?: string;
    readonly style?: CSSProperties;
    readonly menuClassName?: string;
    readonly menuStyle?: CSSProperties;
    readonly ref?: Ref<HTMLDivElement>;
}
```

Members (14):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `value` | `readonly value?: string;` | optional | Key of this menu in `Menubar value` (default generated). |
| `label` | `readonly label: ReactNode;` |  | Content of the top-level item (`ReactNode`). |
| `icon` | `readonly icon?: ReactNode;` | optional | Decorative leading icon (`aria-hidden`). |
| `disabled` | `readonly disabled?: boolean;` | optional | Skipped by arrow keys and typeahead; `aria-disabled="true"`. |
| `textValue` | `readonly textValue?: string;` | optional | Typeahead text when `label` is not plain text. |
| `children` | `readonly children?: 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 |  |
| `renderItem` | `readonly renderItem?: (item: MenuItemData) => ReactNode;` | optional |  |
| `id` | `readonly id?: string;` | optional | DOM id of the top-level item (default generated; the menu is labelled by it). |
| `className` | `readonly className?: string;` | optional |  |
| `style` | `readonly style?: CSSProperties;` | optional |  |
| `menuClassName` | `readonly menuClassName?: string;` | optional |  |
| `menuStyle` | `readonly menuStyle?: CSSProperties;` | optional |  |
| `ref` | `readonly ref?: Ref<HTMLDivElement>;` | optional | The top-level `role="menuitem"` element. |

### MenubarProps

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenubarProps

```ts
interface MenubarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'defaultValue' | 'role' | 'onChange'> {
    readonly children?: ReactNode;
    readonly value?: string | null | undefined;
    readonly defaultValue?: string | null;
    readonly onValueChange?: (value: string | null, event: MenubarValueChangeEvent) => void;
    readonly onBeforeValueChange?: (event: MenubarBeforeValueChangeEvent) => void;
    readonly onAction?: (event: MenuActionEvent) => void;
    readonly submenuOpen?: MenuSubmenuOpen;
    readonly hoverDelay?: number;
    readonly overflow?: 'none' | 'scroll';
    readonly container?: Element | null;
    readonly localeText?: Partial<MenubarLocaleText>;
    readonly ref?: Ref<HTMLDivElement>;
}
```

Members (12):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `children` | `readonly children?: ReactNode;` | optional | `MenubarMenu` and `MenubarItem` elements. |
| `value` | `readonly value?: string \| null \| undefined;` | optional | The open top-level menu (`MenubarMenu value`), or `null`. |
| `defaultValue` | `readonly defaultValue?: string \| null;` | optional |  |
| `onValueChange` | `readonly onValueChange?: (value: string \| null, event: MenubarValueChangeEvent) => void;` | optional |  |
| `onBeforeValueChange` | `readonly onBeforeValueChange?: (event: MenubarBeforeValueChangeEvent) => void;` | optional |  |
| `onAction` | `readonly onAction?: (event: MenuActionEvent) => void;` | optional | A chosen item of any menu or a `MenubarItem`; `event.preventDefault()` keeps the menu open. |
| `submenuOpen` | `readonly submenuOpen?: MenuSubmenuOpen;` | optional | `'hover'` (default): nested submenus open after `hoverDelay`, and while a menu is open the pointer moves it across the bar. `'click'`: both need a click. |
| `hoverDelay` | `readonly hoverDelay?: number;` | optional |  |
| `overflow` | `readonly overflow?: 'none' \| 'scroll';` | optional | `'scroll'`: the bar scrolls when its items do not fit, with indicators at the ends. Default `'none'`. |
| `container` | `readonly container?: Element \| null;` | optional | Portal target of the menus (default `document.body`). |
| `localeText` | `readonly localeText?: Partial<MenubarLocaleText>;` | optional |  |
| `ref` | `readonly ref?: Ref<HTMLDivElement>;` | optional | The `role="menubar"` element. |

### MenubarValueChangeEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/MenubarValueChangeEvent

```ts
interface MenubarValueChangeEvent {
    readonly reason: MenubarValueChangeReason;
    readonly source: MenuSource;
}
```

Second argument of `onValueChange` (frozen in development).

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `reason` | `readonly reason: MenubarValueChangeReason;` |  |  |
| `source` | `readonly source: MenuSource;` |  |  |

### SplitButtonProps

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/SplitButtonProps

```ts
interface SplitButtonProps extends MenuButtonMenuProps, Omit<ButtonBaseProps, 'children' | 'ref' | 'className' | 'style' | 'render' | 'repeat' | 'onRepeat' | 'iconOnly' | 'floating' | 'floatingScope'> {
    readonly children?: ReactNode;
    readonly menuLabel?: string;
    readonly indicator?: ReactNode;
    readonly className?: string;
    readonly style?: CSSProperties;
    readonly classNames?: Partial<Record<SplitButtonPart, string>>;
    readonly styles?: Partial<Record<SplitButtonPart, CSSProperties>>;
    readonly ref?: Ref<HTMLButtonElement>;
}
```

Members (29):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `menu` | `menu?: ReactNode;` | optional, inherited | Menu entries as JSX (`MenuItem`, `MenuCheckboxItem`, `MenuRadioGroup`, `MenuGroup`, `MenuSeparator`, `Submenu`). Wins over `items`. |
| `items` | `items?: readonly MenuItemData[];` | optional, inherited | Data form of the menu entries. |
| `renderItem` | `renderItem?: ((item: MenuItemData) => ReactNode);` | optional, inherited | Content of each `items` entry (default: its `label`). |
| `open` | `open?: boolean;` | optional, inherited |  |
| `defaultOpen` | `defaultOpen?: boolean;` | optional, inherited | Applied after hydration (server and client markup stay identical). |
| `onOpenChange` | `onOpenChange?: ((open: boolean, event: MenuOpenChangeEvent) => void);` | optional, inherited |  |
| `children` | `readonly children?: ReactNode;` | optional | Primary button content (also the group's accessible name). |
| `menuLabel` | `readonly menuLabel?: string;` | optional | Accessible name of the menu trigger (default `"More options"`). |
| `indicator` | `readonly indicator?: ReactNode;` | optional | Trigger content (default chevron). |
| `className` | `readonly className?: string;` | optional | Root (`role="group"`) class and style. |
| `style` | `readonly style?: CSSProperties;` | optional |  |
| `classNames` | `readonly classNames?: Partial<Record<SplitButtonPart, string>>;` | optional |  |
| `styles` | `readonly styles?: Partial<Record<SplitButtonPart, CSSProperties>>;` | optional |  |
| `ref` | `readonly ref?: Ref<HTMLButtonElement>;` | optional | The primary `<button>`. |
| `variant` | `variant?: ButtonVariant;` | optional, inherited | Visual weight. Default `'solid'` (or the group's). |
| `tone` | `tone?: ButtonTone;` | optional, inherited | Color role. Default `'neutral'`; `'primary'` for a `floating` button (or the group's). |
| `size` | `size?: ButtonSize;` | optional, inherited | Metric set. Default `'md'` (or the group's). |
| `iconStart` | `iconStart?: ReactNode;` | optional, inherited | Decorative icon before the label (inline-start; follows `dir`). |
| `iconEnd` | `iconEnd?: ReactNode;` | optional, inherited | Decorative icon after the label (inline-end; follows `dir`). |
| `loading` | `loading?: boolean;` | optional, inherited | Shows a spinner, sets `aria-busy` and `aria-disabled` (focus is kept) and ignores activation. |
| `loadingLabel` | `loadingLabel?: string;` | optional, inherited | Visually hidden text appended to the name while `loading`. Default `"Loading"`. |
| `spinner` | `spinner?: ReactNode;` | optional, inherited | Replaces the built-in spinner graphic. |
| `progress` | `progress?: number;` | optional, inherited | Progress fill from inline-start, 0 to 100. No spinner unless `loading`. |
| `progressLabel` | `progressLabel?: ((value: number) => string);` | optional, inherited | Visually hidden progress text appended to the name. Default `` `${value}%` ``. |
| `onAction` | `onAction?: ((event: MenuActionEvent) => void);` | optional, inherited | A chosen item (any level); `event.preventDefault()` keeps the menu open. |
| `placement` | `placement?: MenuPlacement;` | optional, inherited | Default `'bottom-start'`; flips and shifts to stay in the viewport; logical (mirrored in RTL). |
| `container` | `container?: Element \| null;` | optional, inherited | Portal target (default: the trigger's `document.body`). |
| `submenuOpen` | `submenuOpen?: MenuSubmenuOpen;` | optional, inherited | Submenus open after a pointer rest of `hoverDelay` ms (default `'hover'`) or on click only. |
| `hoverDelay` | `hoverDelay?: number;` | optional, inherited | Hover intent of submenus in ms (default 200). |

### SubmenuProps

Kind: interface

Page: https://salmonui.dev/docs/reference/buttons/menu/SubmenuProps

```ts
interface SubmenuProps extends Omit<ItemCommonProps, 'children' | 'onClick'> {
    readonly id?: string;
    readonly label: ReactNode;
    readonly children?: ReactNode;
    readonly menuClassName?: string;
    readonly menuStyle?: CSSProperties;
}
```

Members (11):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `id` | `readonly id?: string;` | optional | DOM id of the submenu item (default generated; the submenu is labelled by it). |
| `label` | `readonly label: ReactNode;` |  | Content of the item that opens the submenu. |
| `children` | `readonly children?: ReactNode;` | optional | The submenu entries. |
| `menuClassName` | `readonly menuClassName?: string;` | optional | Class name and style of the submenu popup. |
| `menuStyle` | `readonly menuStyle?: CSSProperties;` | optional |  |
| `icon` | `icon?: ReactNode;` | optional, inherited | Decorative leading icon (`aria-hidden`). |
| `disabled` | `disabled?: boolean;` | optional, inherited | Skipped by arrow keys and typeahead; `aria-disabled="true"`. |
| `textValue` | `textValue?: string;` | optional, inherited | Typeahead text when the children are not plain text. |
| `className` | `className?: string;` | optional, inherited |  |
| `style` | `style?: CSSProperties;` | optional, inherited |  |
| `ref` | `ref?: Ref<HTMLElement>;` | optional, inherited |  |

## Types

### ContextMenuPart

Kind: type

Page: https://salmonui.dev/docs/reference/buttons/menu/ContextMenuPart

```ts
type ContextMenuPart = 'menu';
```

Popup parts that accept `classNames` / `styles`.

### ContextMenuSource

Kind: type

Page: https://salmonui.dev/docs/reference/buttons/menu/ContextMenuSource

```ts
type ContextMenuSource = 'pointer' | 'touch' | 'keyboard';
```

Input that asked for the menu.

### MenuButtonPart

Kind: type

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuButtonPart

```ts
type MenuButtonPart = 'menu';
```

Popup parts that accept `classNames` / `styles`.

### MenuButtonProps

Kind: type

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuButtonProps

```ts
type MenuButtonProps = MenuButtonBaseProps & ({
    readonly iconOnly?: false | undefined;
} | ({
    readonly iconOnly: true;
} & ButtonAccessibleName));
```

An `iconOnly` trigger needs `aria-label` or `aria-labelledby`.

### MenuItemRenderProps

Kind: type

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuItemRenderProps

```ts
type MenuItemRenderProps = HTMLAttributes<HTMLElement> & {
    readonly ref: (element: HTMLElement | null) => void;
    readonly role: string;
    readonly tabIndex: number;
    readonly 'data-item-id'?: string;
    readonly href?: string;
    readonly target?: string;
};
```

Props passed to a custom item element (`render`): spread them all.

Members (6):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `tabIndex` | `tabIndex: number;` | inherited |  |
| `role` | `role: string;` | inherited |  |
| `ref` | `ref: (element: HTMLElement \| null) => void;` | inherited | Callback ref (assignable to any element's ref). |
| `data-item-id` | `data-item-id?: string;` | optional, inherited |  |
| `href` | `href?: string;` | optional, inherited |  |
| `target` | `target?: string;` | optional, inherited |  |

### MenuOpenChangeReason

Kind: type

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuOpenChangeReason

```ts
type MenuOpenChangeReason = 'trigger' | 'escape' | 'outside' | 'action' | 'tab';
```

Why a menu opened or closed.

### MenuPlacement

Kind: type

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuPlacement

```ts
type MenuPlacement = 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end';
```

Popup side relative to the trigger; `start` / `end` are logical (mirrored under `dir="rtl"`).

### MenuSource

Kind: type

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuSource

```ts
type MenuSource = 'pointer' | 'keyboard' | 'touch' | 'api';
```

Input that caused a change or an action.

### MenuSubmenuOpen

Kind: type

Page: https://salmonui.dev/docs/reference/buttons/menu/MenuSubmenuOpen

```ts
type MenuSubmenuOpen = 'hover' | 'click';
```

How submenus open: after a pointer rest (`hoverDelay`) or on click only. Keyboard always works.

### MenubarValueChangeReason

Kind: type

Page: https://salmonui.dev/docs/reference/buttons/menu/MenubarValueChangeReason

```ts
type MenubarValueChangeReason = MenuOpenChangeReason | 'navigate';
```

Why the open top-level menu changed; `'navigate'` is an arrow key or the pointer moving across the bar.

### SplitButtonPart

Kind: type

Page: https://salmonui.dev/docs/reference/buttons/menu/SplitButtonPart

```ts
type SplitButtonPart = 'primary' | 'trigger' | 'menu';
```

Parts that accept `classNames` / `styles`.

## Constants

### CONTEXT_MENU_DEFAULT_LOCALE_TEXT

Kind: const

Page: https://salmonui.dev/docs/reference/buttons/menu/CONTEXT_MENU_DEFAULT_LOCALE_TEXT

```ts
const CONTEXT_MENU_DEFAULT_LOCALE_TEXT: ContextMenuLocaleText;
```

### MENUBAR_DEFAULT_LOCALE_TEXT

Kind: const

Page: https://salmonui.dev/docs/reference/buttons/menu/MENUBAR_DEFAULT_LOCALE_TEXT

```ts
const MENUBAR_DEFAULT_LOCALE_TEXT: MenubarLocaleText;
```
