FormControlLabel API
The API documentation of the FormControlLabel React component. Learn more about the properties and the CSS customization points.
import FormControlLabel from '@material-ui/core/FormControlLabel';
Drop in replacement of the Radio
, Switch
and Checkbox
component.
Use this component if you want to display an extra label.
Props
Name | Type | Default | Description |
---|---|---|---|
checked | bool | If true , the component appears selected. |
|
classes | object | Override or extend the styles applied to the component. See CSS API below for more details. | |
control | element | A control element. For instance, it can be be a Radio , a Switch or a Checkbox . |
|
disabled | bool | If true , the control will be disabled. |
|
inputRef | union: func | object |
This prop can be used to pass a ref callback to the input element. |
|
label | node | The text to be used in an enclosing label element. | |
labelPlacement | enum: 'end' | 'start' | 'top' | 'bottom' |
'end' | The position of the label. |
name | string | ||
onChange | func | Callback fired when the state is changed. Signature: function(event: object, checked: boolean) => void event: The event source of the callback. You can pull out the new value by accessing event.target.checked .checked: The checked value of the switch |
|
value | any | The value of the component. |
The ref
is forwarded to the root element.
Any other properties supplied will be provided to the root element (native element).
CSS
You can override all the class names injected by Material-UI thanks to the classes
prop.
This prop accepts the following keys:
Name | Description |
---|---|
root | Styles applied to the root element. |
labelPlacementStart | Styles applied to the root element if labelPlacement="start" . |
labelPlacementTop | Styles applied to the root element if labelPlacement="top" . |
labelPlacementBottom | Styles applied to the root element if labelPlacement="bottom" . |
disabled | Pseudo-class applied to the root element if disabled={true} . |
label | Styles applied to the label's Typography component. |
Have a look at the overriding styles with classes section and the implementation of the component for more detail.
If using the overrides
key of the theme,
you need to use the following style sheet name: MuiFormControlLabel
.
Notes
The component is fully StrictMode compatible.