@material-ui/core
Version:
React components that implement Google's Material Design.
70 lines (66 loc) • 1.85 kB
TypeScript
import * as React from 'react';
import { StandardProps } from '..';
export interface FormControlLabelProps
extends StandardProps<
React.LabelHTMLAttributes<HTMLLabelElement>,
FormControlLabelClassKey,
'children' | 'onChange'
> {
/**
* If `true`, the component appears selected.
*/
checked?: boolean;
/**
* A control element. For instance, it can be be a `Radio`, a `Switch` or a `Checkbox`.
*/
control: React.ReactElement<any, any>;
/**
* If `true`, the control will be disabled.
*/
disabled?: boolean;
/**
* Pass a ref to the `input` element.
*/
inputRef?: React.Ref<any>;
/**
* The text to be used in an enclosing label element.
*/
label: React.ReactNode;
/**
* The position of the label.
*/
labelPlacement?: 'end' | 'start' | 'top' | 'bottom';
name?: string;
/**
* Callback fired when the state is changed.
*
* @param {object} event The event source of the callback.
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
*/
onChange?: (event: React.ChangeEvent<{}>, checked: boolean) => void;
/**
* The value of the component.
*/
value?: unknown;
}
export type FormControlLabelClassKey =
| 'root'
| 'labelPlacementStart'
| 'labelPlacementTop'
| 'labelPlacementBottom'
| 'disabled'
| 'label';
/**
* Drop in replacement of the `Radio`, `Switch` and `Checkbox` component.
* Use this component if you want to display an extra label.
* Demos:
*
* - [Checkboxes](https://mui.com/components/checkboxes/)
* - [Radio Buttons](https://mui.com/components/radio-buttons/)
* - [Switches](https://mui.com/components/switches/)
*
* API:
*
* - [FormControlLabel API](https://mui.com/api/form-control-label/)
*/
export default function FormControlLabel(props: FormControlLabelProps): JSX.Element;