UNPKG

@itwin/itwinui-react

Version:

A react component library for iTwinUI

78 lines (77 loc) 2.06 kB
import * as React from 'react'; import type { PolymorphicForwardRefComponent } from '../../utils/index.js'; import type { ListItemOwnProps } from '../List/ListItem.js'; export type MenuItemProps = { /** * Item is selected. */ isSelected?: boolean; /** * Item is disabled. */ disabled?: boolean; } & ({ /** * Value of the item. * @deprecated */ value: unknown; /** * Callback function that handles click and keyboard submit actions. */ onClick?: (value?: unknown) => void; } | { /** @deprecated */ value?: never; onClick?: (event?: React.MouseEvent) => void; }) & { /** * Modify height of the item. * Use 'large' when any of the sibling items have `sublabel`. * * Defaults to 'large' if `sublabel` provided, otherwise 'default'. */ size?: 'default' | 'large'; /** * Sub label shown below the main content of the item. */ sublabel?: React.ReactNode; /** * SVG icon component shown on the left. */ startIcon?: React.JSX.Element; /** * @deprecated Use startIcon. * SVG icon component shown on the left. */ icon?: React.JSX.Element; /** * SVG icon component shown on the right. */ endIcon?: React.JSX.Element; /** * @deprecated Use endIcon. * SVG icon component shown on the right. */ badge?: React.JSX.Element; /** * ARIA role. For menu item use 'menuitem', for select item use 'option'. * @default 'menuitem' */ role?: string; /** * Items to be shown in the submenu when hovered over the item. */ subMenuItems?: React.JSX.Element[]; /** * Content of the menu item. */ children?: React.ReactNode; } & Pick<ListItemOwnProps, 'focused'>; /** * Basic menu item component. Should be used inside `Menu` component for each item. */ export declare const MenuItem: PolymorphicForwardRefComponent<"div", MenuItemProps>; export type TreeEvent = { nodeId: string; parentId: string | null; };