FormControlLabel API
Demos
For examples and details on the usage of this React component, visit the component demo pages:
Import
import FormControlLabel from '@mui/material/FormControlLabel';
// or
import { FormControlLabel } from '@mui/material';
Drop-in replacement of the Radio
, Switch
and Checkbox
component.
Use this component if you want to display an extra label.
Component name
The nameMuiFormControlLabel
can be used when providing default props or style overrides in the theme.Props
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
control* | element | A control element. For instance, it can be a Radio , a Switch or a Checkbox . | |
checked | bool | false | If true , the component appears selected. |
classes | object | Override or extend the styles applied to the component. See CSS API below for more details. | |
componentsProps | { typography?: object } | {} | The props used for each slot inside. |
disabled | bool | false | If true , the control is disabled. |
disableTypography | bool | false | If true , the label is rendered as it is passed without an additional typography node. |
inputRef | ref | Pass a ref to the input element. | |
label | node | A text or an element to be used in an enclosing label element. | |
labelPlacement | 'bottom' | 'end' | 'start' | 'top' | 'end' | The position of the label. |
onChange | func | Callback fired when the state is changed. Signature: function(event: React.SyntheticEvent) => void event: The event source of the callback. You can pull out the new checked state by accessing event.target.checked (boolean). | |
slotProps | { typography?: object } | {} | The props used for each slot inside. |
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
ref
is forwarded to the root element.CSS
Rule name | Global class | Description |
---|---|---|
root | .MuiFormControlLabel-root | Styles applied to the root element. |
labelPlacementStart | .MuiFormControlLabel-labelPlacementStart | Styles applied to the root element if labelPlacement="start" . |
labelPlacementTop | .MuiFormControlLabel-labelPlacementTop | Styles applied to the root element if labelPlacement="top" . |
labelPlacementBottom | .MuiFormControlLabel-labelPlacementBottom | Styles applied to the root element if labelPlacement="bottom" . |
disabled | .Mui-disabled | State class applied to the root element if disabled={true} . |
label | .MuiFormControlLabel-label | Styles applied to the label's Typography component. |
error | .Mui-error | State class applied to the root element if error={true} . |
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverrides
property in a custom theme.