MenuItem API
Importação
import MenuItem from '@mui/material/MenuItem';
// ou
import { MenuItem } from '@mui/material';Nome do componente
The nameMuiMenuItem can be used when providing default props or style overrides in the theme.Propriedades
Propriedades do componente ButtonBase também estão disponíveis.
| Nome | Tipo | Padrão | Descrição | 
|---|---|---|---|
| autoFocus | bool | false | If  true, the list item is focused during the first mount. Focus will also be triggered if the value changes from false to true. | 
| children | node | O conteúdo do componente. | |
| classes | object | Sobrescreve ou extende os estilos aplicados para o componente. Veja a API CSS abaixo para maiores detalhes. | |
| component | elementType | The component used for the root node. Either a string to use a HTML element or a component. | |
| dense | bool | false | If  true, compact vertical padding designed for keyboard and mouse input is used. The prop defaults to the value inherited from the parent List component. | 
| disableGutters | bool | false | If  true, the left and right padding is removed. | 
| divider | bool | false | Se  true, uma borda clara de 1px será adicionada à parte inferior do item do menu. | 
| focusVisibleClassName | string | This prop can help identify which element has keyboard focus. The class name will be applied when the element gains the focus through keyboard interaction. It's a polyfill for the CSS :focus-visible selector. The rationale for using this feature is explained here. A polyfill can be used to apply a  focus-visibleclass to other components if needed. | |
| sx | Array<func | object | bool> | func | object | The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details. | 
O
ref é encaminhado para o elemento raiz.Herança
While not explicitly documented above, the props of the ButtonBase component are also available on MenuItem. You can take advantage of this to target nested components.CSS
| Nome da regra | Classe global | Descrição | 
|---|---|---|
| root | .MuiMenuItem-root | Estilos aplicados ao elemento raiz. | 
| focusVisible | .Mui-focusVisible | State class applied to the root element if keyboard focused. | 
| dense | .MuiMenuItem-dense | Estilos aplicados para o elemento raiz se dense. | 
| disabled | .Mui-disabled | State class applied to the root element if disabled={true}. | 
| divider | .MuiMenuItem-divider | Styles applied to the root element if divider={true}. | 
| gutters | .MuiMenuItem-gutters | Estilos aplicados em o elemento raiz a menos que disableGutters={true}. | 
| selected | .Mui-selected | Estilos aplicados para o elemento raiz se selected={true}. | 
Você pode sobrescrever o estilo do componente usando uma dessas opções de customização:
- With a global class name.
- With a rule name as part of the component's styleOverridesproperty in a custom theme.