1 | import * as React from "react";
|
2 | import { AbstractPureComponent2 } from "../../common";
|
3 | import { ActionProps, LinkProps } from "../../common/props";
|
4 | import { IPopoverProps } from "../popover/popover";
|
5 | export declare type MenuItemProps = IMenuItemProps;
|
6 | /** @deprecated use MenuItemProps */
|
7 | export interface IMenuItemProps extends ActionProps, LinkProps {
|
8 | /** Item text, required for usability. */
|
9 | text: React.ReactNode;
|
10 | /**
|
11 | * Whether this item should render with an active appearance.
|
12 | * This is the same styling as the `:active` CSS element state.
|
13 | *
|
14 | * Note: in Blueprint 3.x, this prop was conflated with a "selected" appearance
|
15 | * when `intent` was undefined. For legacy purposes, we emulate this behavior in
|
16 | * Blueprint 4.x, so setting `active={true} intent={undefined}` is the same as
|
17 | * `selected={true}`. This prop will be removed in a future major version.
|
18 | *
|
19 | * @deprecated use `selected` prop
|
20 | */
|
21 | active?: boolean;
|
22 | /**
|
23 | * Children of this component will be rendered in a __submenu__ that appears when hovering or
|
24 | * clicking on this menu item.
|
25 | *
|
26 | * Use `text` prop for the content of the menu item itself.
|
27 | */
|
28 | children?: React.ReactNode;
|
29 | /**
|
30 | * Whether this menu item is non-interactive. Enabling this prop will ignore `href`, `tabIndex`,
|
31 | * and mouse event handlers (in particular click, down, enter, leave).
|
32 | */
|
33 | disabled?: boolean;
|
34 | /**
|
35 | * Right-aligned label text content, useful for displaying hotkeys.
|
36 | *
|
37 | * This prop actually supports JSX elements, but TypeScript will throw an error because
|
38 | * `HTMLAttributes` only allows strings. Use `labelElement` to supply a JSX element in TypeScript.
|
39 | */
|
40 | label?: string;
|
41 | /**
|
42 | * A space-delimited list of class names to pass along to the right-aligned label wrapper element.
|
43 | */
|
44 | labelClassName?: string;
|
45 | /**
|
46 | * Right-aligned label content, useful for displaying hotkeys.
|
47 | */
|
48 | labelElement?: React.ReactNode;
|
49 | /**
|
50 | * Whether the text should be allowed to wrap to multiple lines.
|
51 | * If `false`, text will be truncated with an ellipsis when it reaches `max-width`.
|
52 | *
|
53 | * @default false
|
54 | */
|
55 | multiline?: boolean;
|
56 | /**
|
57 | * Props to spread to `Popover`. Note that `content` and `minimal` cannot be
|
58 | * changed and `usePortal` defaults to `false` so all submenus will live in
|
59 | * the same container.
|
60 | */
|
61 | popoverProps?: Partial<IPopoverProps>;
|
62 | /**
|
63 | * Whether this item should appear selected.
|
64 | */
|
65 | selected?: boolean;
|
66 | /**
|
67 | * Whether an enabled item without a submenu should automatically close its parent popover when clicked.
|
68 | *
|
69 | * @default true
|
70 | */
|
71 | shouldDismissPopover?: boolean;
|
72 | /**
|
73 | * Name of the HTML tag that wraps the MenuItem.
|
74 | *
|
75 | * @default "a"
|
76 | */
|
77 | tagName?: keyof JSX.IntrinsicElements;
|
78 | /**
|
79 | * A space-delimited list of class names to pass along to the text wrapper element.
|
80 | */
|
81 | textClassName?: string;
|
82 | /**
|
83 | * HTML title to be passed to the <Text> component
|
84 | */
|
85 | htmlTitle?: string;
|
86 | }
|
87 | export declare class MenuItem extends AbstractPureComponent2<MenuItemProps & React.AnchorHTMLAttributes<HTMLAnchorElement>> {
|
88 | static defaultProps: MenuItemProps;
|
89 | static displayName: string;
|
90 | render(): JSX.Element;
|
91 | private maybeRenderLabel;
|
92 | private maybeRenderPopover;
|
93 | }
|