InputLabel API
Importação
import InputLabel from '@mui/material/InputLabel';
// ou
import { InputLabel } from '@mui/material';Nome do componente
The nameMuiInputLabel can be used when providing default props or style overrides in the theme.Propriedades
Propriedades do componente FormLabel também estão disponíveis.
| Nome | Tipo | Padrão | Descrição | 
|---|---|---|---|
| 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. | |
| color | 'error' | 'info' | 'primary' | 'secondary' | 'success' | 'warning' | string | The color of the component. It supports both default and custom theme colors, which can be added as shown in the palette customization guide. | |
| disableAnimation | bool | false | If  true, the transition animation is disabled. | 
| disabled | bool | false | Se  true, o componente está desabilitado. | 
| error | bool | false | If  true, the label should be displayed in an error state. | 
| focused | bool | false | If  true, theinputof this label is focused. | 
| margin | 'dense' | If  dense, will adjust vertical spacing. This is normally obtained via context from FormControl. | |
| required | bool | false | if  true, the label will indicate that theinputis required. | 
| shrink | bool | false | If  true, the label is shrunk. | 
| size | 'normal' | 'small' | 'normal' | The size of the component. | 
| 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. | |
| variant | 'filled' | 'outlined' | 'standard' | A variante a usar. | 
O
ref é encaminhado para o elemento raiz.Herança
While not explicitly documented above, the props of the FormLabel component are also available on InputLabel. You can take advantage of this to target nested components.CSS
| Nome da regra | Classe global | Descrição | 
|---|---|---|
| root | .MuiInputLabel-root | Estilos aplicados ao elemento raiz. | 
| focused | .Mui-focused | Pseudo-class aplicada a o elemento raiz se focused={true}. | 
| disabled | .Mui-disabled | Pseudo-class aplicada a o elemento raiz se disabled={true}. | 
| error | .Mui-error | Pseudo-class aplicada a o elemento raiz se error={true}. | 
| required | .Mui-required | Pseudo-class aplicada a o elemento raiz se required={true}. | 
| asterisk | .MuiInputLabel-asterisk | Pseudo-class applied to the asterisk element. | 
| formControl | .MuiInputLabel-formControl | Estilos aplicados para o elemento raiz se the component is a descendant of FormControl. | 
| sizeSmall | .MuiInputLabel-sizeSmall | Estilos aplicados para o elemento raiz se size="small". | 
| shrink | .MuiInputLabel-shrink | Estilos aplicados para the input element se shrink={true}. | 
| animated | .MuiInputLabel-animated | Estilos aplicados em the input element a menos que disableAnimation={true}. | 
| filled | .MuiInputLabel-filled | Estilos aplicados para o elemento raiz se variant="filled". | 
| outlined | .MuiInputLabel-outlined | Estilos aplicados para o elemento raiz se variant="outlined". | 
| standard | .MuiInputLabel-standard | Estilos aplicados para o elemento raiz se variant="standard". | 
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.