1 | import * as React from 'react';
|
2 | import { SxProps } from '@mui/system';
|
3 | import { InternalStandardProps as StandardProps } from '..';
|
4 | import { PaperProps } from '../Paper';
|
5 | import { PopoverProps } from '../Popover';
|
6 | import { MenuListProps } from '../MenuList';
|
7 | import { Theme } from '../styles';
|
8 | import { TransitionProps } from '../transitions/transition';
|
9 | import { MenuClasses } from './menuClasses';
|
10 |
|
11 | export interface MenuProps extends StandardProps<PopoverProps> {
|
12 | /**
|
13 | * An HTML element, or a function that returns one.
|
14 | * It's used to set the position of the menu.
|
15 | */
|
16 | anchorEl?: PopoverProps['anchorEl'];
|
17 | /**
|
18 | * If `true` (Default) will focus the `[role="menu"]` if no focusable child is found. Disabled
|
19 | * children are not focusable. If you set this prop to `false` focus will be placed
|
20 | * on the parent modal container. This has severe accessibility implications
|
21 | * and should only be considered if you manage focus otherwise.
|
22 | * @default true
|
23 | */
|
24 | autoFocus?: boolean;
|
25 | /**
|
26 | * Menu contents, normally `MenuItem`s.
|
27 | */
|
28 | children?: React.ReactNode;
|
29 | /**
|
30 | * Override or extend the styles applied to the component.
|
31 | */
|
32 | classes?: Partial<MenuClasses>;
|
33 | /**
|
34 | * When opening the menu will not focus the active item but the `[role="menu"]`
|
35 | * unless `autoFocus` is also set to `false`. Not using the default means not
|
36 | * following WAI-ARIA authoring practices. Please be considerate about possible
|
37 | * accessibility implications.
|
38 | * @default false
|
39 | */
|
40 | disableAutoFocusItem?: boolean;
|
41 | /**
|
42 | * Props applied to the [`MenuList`](https://mui.com/material-ui/api/menu-list/) element.
|
43 | * @default {}
|
44 | */
|
45 | MenuListProps?: Partial<MenuListProps>;
|
46 | /**
|
47 | * Callback fired when the component requests to be closed.
|
48 | *
|
49 | * @param {object} event The event source of the callback.
|
50 | * @param {string} reason Can be: `"escapeKeyDown"`, `"backdropClick"`, `"tabKeyDown"`.
|
51 | */
|
52 | onClose?: PopoverProps['onClose'];
|
53 | /**
|
54 | * If `true`, the component is shown.
|
55 | */
|
56 | open: boolean;
|
57 | /**
|
58 | * `classes` prop applied to the [`Popover`](https://mui.com/material-ui/api/popover/) element.
|
59 | */
|
60 | PopoverClasses?: PopoverProps['classes'];
|
61 | /**
|
62 | * The system prop that allows defining system overrides as well as additional CSS styles.
|
63 | */
|
64 | sx?: SxProps<Theme>;
|
65 | /**
|
66 | * The length of the transition in `ms`, or 'auto'
|
67 | * @default 'auto'
|
68 | */
|
69 | transitionDuration?: TransitionProps['timeout'] | 'auto';
|
70 | /**
|
71 | * Props applied to the transition element.
|
72 | * By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.
|
73 | * @default {}
|
74 | */
|
75 | TransitionProps?: TransitionProps;
|
76 | /**
|
77 | * The variant to use. Use `menu` to prevent selected items from impacting the initial focus.
|
78 | * @default 'selectedMenu'
|
79 | */
|
80 | variant?: 'menu' | 'selectedMenu';
|
81 | }
|
82 |
|
83 | export declare const MenuPaper: React.FC<PaperProps>;
|
84 |
|
85 | /**
|
86 | *
|
87 | * Demos:
|
88 | *
|
89 | * - [App Bar](https://mui.com/material-ui/react-app-bar/)
|
90 | * - [Menu](https://mui.com/material-ui/react-menu/)
|
91 | *
|
92 | * API:
|
93 | *
|
94 | * - [Menu API](https://mui.com/material-ui/api/menu/)
|
95 | * - inherits [Popover API](https://mui.com/material-ui/api/popover/)
|
96 | */
|
97 | export default function Menu(props: MenuProps): React.JSX.Element;
|