View as Markdown

API reference: @salmonui/buttons/menu

MenuItemDatainterface

import type { MenuItemData } from '@salmonui/buttons/menu';
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.

MenuItemData members (10)
NameSignatureDescription
typeoptionalreadonly type?: 'item' | 'separator' | 'group';
idoptionalreadonly id?: string;

Stable item key, reported in onAction (required for items).

labeloptionalreadonly label?: ReactNode;
textValueoptionalreadonly textValue?: string;

Typeahead text when label is not plain text.

iconoptionalreadonly icon?: ReactNode;
disabledoptionalreadonly disabled?: boolean;
hrefoptionalreadonly href?: string;

Renders the item as a link (<a role="menuitem">).

targetoptionalreadonly target?: string;
titleoptionalreadonly title?: string;
itemsoptionalreadonly items?: readonly MenuItemData[];

Submenu entries (type 'item') or group entries (type 'group').