UNPKG

2.21 kBTypeScriptView Raw
1import * as React from 'react';
2import { SxProps } from '@mui/system';
3import { Theme } from '../styles';
4import { ExtendButtonBase, ExtendButtonBaseTypeMap } from '../ButtonBase';
5import { OverrideProps } from '../OverridableComponent';
6import { MenuItemClasses } from './menuItemClasses';
7
8export interface MenuItemOwnProps {
9 /**
10 * If `true`, the list item is focused during the first mount.
11 * Focus will also be triggered if the value changes from false to true.
12 * @default false
13 */
14 autoFocus?: boolean;
15 /**
16 * Override or extend the styles applied to the component.
17 */
18 classes?: Partial<MenuItemClasses>;
19 /**
20 * If `true`, compact vertical padding designed for keyboard and mouse input is used.
21 * The prop defaults to the value inherited from the parent Menu component.
22 * @default false
23 */
24 dense?: boolean;
25 /**
26 * If `true`, the component is disabled.
27 * @default false
28 */
29 disabled?: boolean;
30 /**
31 * If `true`, the left and right padding is removed.
32 * @default false
33 */
34 disableGutters?: boolean;
35 /**
36 * If `true`, a 1px light border is added to the bottom of the menu item.
37 * @default false
38 */
39 divider?: boolean;
40 /**
41 * If `true`, the component is selected.
42 * @default false
43 */
44 selected?: boolean;
45 /**
46 * The system prop that allows defining system overrides as well as additional CSS styles.
47 */
48 sx?: SxProps<Theme>;
49}
50
51export type MenuItemTypeMap<
52 AdditionalProps = {},
53 RootComponent extends React.ElementType = 'li',
54> = ExtendButtonBaseTypeMap<{
55 props: AdditionalProps & MenuItemOwnProps;
56 defaultComponent: RootComponent;
57}>;
58
59/**
60 *
61 * Demos:
62 *
63 * - [Menu](https://mui.com/material-ui/react-menu/)
64 *
65 * API:
66 *
67 * - [MenuItem API](https://mui.com/material-ui/api/menu-item/)
68 * - inherits [ButtonBase API](https://mui.com/material-ui/api/button-base/)
69 */
70declare const MenuItem: ExtendButtonBase<MenuItemTypeMap>;
71
72export type MenuItemProps<
73 RootComponent extends React.ElementType = MenuItemTypeMap['defaultComponent'],
74 AdditionalProps = {},
75> = OverrideProps<MenuItemTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
76 component?: React.ElementType;
77};
78
79export default MenuItem;