View as Markdown

API reference: @salmonui/buttons/menu

MenuItemPropsinterface

import type { MenuItemProps } from '@salmonui/buttons/menu';
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;
}
MenuItemProps members (14, 8 inherited)
NameSignatureDescription
idreadonly id: string;

Stable item key reported in onAction (data-item-id; not the DOM id).

itemoptionalreadonly item?: MenuItemData | undefined;

The data entry reported in onAction (set by the items form).

hrefoptionalreadonly href?: string | undefined;

Renders <a role="menuitem" href>.

targetoptionalreadonly target?: string | undefined;
onActionoptionalreadonly onAction?: (event: MenuActionEvent) => void;

This item was chosen; event.preventDefault() keeps the menu open. Runs before the menu's onAction.

renderoptionalreadonly render?: (props: MenuItemRenderProps) => ReactElement;

Custom element (router links): render={(props) => <Link {...props} to="/x" />}.

childrenoptionalinheritedchildren?: ReactNode;
iconoptionalinheritedicon?: ReactNode;

Decorative leading icon (aria-hidden).

disabledoptionalinheriteddisabled?: boolean;

Skipped by arrow keys and typeahead; aria-disabled="true".

textValueoptionalinheritedtextValue?: string;

Typeahead text when the children are not plain text.

classNameoptionalinheritedclassName?: string;
styleoptionalinheritedstyle?: CSSProperties;
refoptionalinheritedref?: Ref<HTMLElement>;
onClickoptionalinheritedonClick?: ((event: MouseEvent<HTMLElement, MouseEvent>) => void);