Перейти к контенту

FormControlLabel API

API documentation for the React FormControlLabel component. Learn about the available props, and the CSS API.

Import

import FormControlLabel from '@material-ui/core/FormControlLabel';
// или
import { FormControlLabel } from '@material-ui/core';
You can learn about the difference by reading this guide on minimizing bundle size.

Drop in replacement of the Radio, Switch and Checkbox component. Use this component if you want to display an extra label.

Component name

The name MuiFormControlLabel can be used when providing default props or style overrides in the theme.

Props

ИмяТипПо-умолчаниюОписание
control*elementA control element. For instance, it can be a Radio, a Switch or a Checkbox.
checkedboolfalseIf true, the component appears selected.
classesobjectOverride or extend the styles applied to the component. See CSS API below for more details.
componentPropsobject{}
disabledboolfalseIf true, the control is disabled.
disableTypographyboolfalse
inputRefrefPass a ref to the input element.
labelnodeThe text to be used in an enclosing label element.
labelPlacement'bottom'
| 'end'
| 'start'
| 'top'
'end'The position of the label.
onChangefuncCallback 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).
sxobject
valueanyThe 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 nameGlobal classОписание
root.MuiFormControlLabel-rootStyles applied to the root element.
labelPlacementStart.MuiFormControlLabel-labelPlacementStartStyles applied to the root element if labelPlacement="start".
labelPlacementTop.MuiFormControlLabel-labelPlacementTopStyles applied to the root element if labelPlacement="top".
labelPlacementBottom.MuiFormControlLabel-labelPlacementBottomStyles applied to the root element if labelPlacement="bottom".
disabled.Mui-disabledPseudo-class applied to the root element if disabled={true}.
label.MuiFormControlLabel-labelStyles applied to the label's Typography component.

You can override the style of the component using one of these customization options:

Demos