FormControlLabel API
The API documentation of the FormControlLabel React component. Learn more about the props and the CSS customization points.
Import
import FormControlLabel from '@material-ui/core/FormControlLabel';
// or
import { FormControlLabel } from '@material-ui/core';
You can learn more about the difference by reading this guide.
Drop in replacement of the Radio
, Switch
and Checkbox
component.
Use this component if you want to display an extra label.
Component name
The MuiFormControlLabel
name can be used for providing default props or style overrides at the theme level.
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 | ref | Pass a ref to the input element. |
|
label | node | The text 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: object) => void event: The event source of the callback. You can pull out the new checked state by accessing event.target.checked (boolean). |
|
value | any | The value of the component. |
The ref
is forwarded to the root element.
Any other props supplied will be provided to the root element (native 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 | Pseudo-class applied to the root element if disabled={true} . |
label | .MuiFormControlLabel-label | Styles applied to the label's Typography component. |
You can override the style of the component thanks to one of these customization points:
- With a rule name of the
classes
object prop. - With a global class name.
- With a theme and an
overrides
property.
If that's not sufficient, you can check the implementation of the component for more detail.