Radio API
Importação
import Radio from '@mui/material/Radio';
// ou
import { Radio } from '@mui/material';Nome do componente
The nameMuiRadio 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 | 
|---|---|---|---|
| checked | bool | false | If  true, the component is checked. | 
| checkedIcon | node | <RadioButtonIcon checked /> | The icon to display when the component is checked. | 
| classes | object | Sobrescreve ou extende os estilos aplicados para o componente. Veja a API CSS abaixo para maiores detalhes. | |
| color | 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | string | 'primary' | The color of the component. It supports both default and custom theme colors, which can be added as shown in the palette customization guide. | 
| disabled | bool | false | Se  true, o componente está desabilitado. | 
| disableRipple | bool | false | If  true, the ripple effect is disabled. | 
| icon | node | <RadioButtonIcon /> | The icon to display when the component is unchecked. | 
| id | string | The id of the  inputelement. | |
| inputProps | object | Attributes applied to the  inputelement. | |
| inputRef | ref | Pass a ref to the  inputelement. | |
| name | string | Name attribute of the  inputelement. | |
| onChange | func | Callback fired when the state is changed. Signature: function(event: object) => voidevent: The event source of the callback. You can pull out the new value by accessing event.target.value(string). You can pull out the new checked state by accessingevent.target.checked(boolean). | |
| required | bool | false | If  true, theinputelement is required. | 
| size | 'medium' | 'small' | string | 'medium' | The size of the radio.  smallis equivalent to the dense radio styling. | 
| 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. | |
| value | any | The value of the component. The DOM API casts this to a string. | 
O
ref é encaminhado para o elemento raiz.Herança
While not explicitly documented above, the props of the ButtonBase component are also available on Radio. You can take advantage of this to target nested components.CSS
| Nome da regra | Classe global | Descrição | 
|---|---|---|
| root | .MuiRadio-root | Estilos aplicados ao elemento raiz. | 
| checked | .Mui-checked | Pseudo-class aplicada a o elemento raiz se checked={true}. | 
| disabled | .Mui-disabled | Pseudo-class aplicada a o elemento raiz se disabled={true}. | 
| colorPrimary | .MuiRadio-colorPrimary | Estilos aplicados para o elemento raiz se color="primary". | 
| colorSecondary | .MuiRadio-colorSecondary | Estilos aplicados para o elemento raiz se color="secondary". | 
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.