Local modifications to ClusterLabs/Anvil by Alteeve
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
672 B

import { FormControlLabel } from '@mui/material';
import { FC, useMemo } from 'react';
import Checkbox from './Checkbox';
import { BodyText } from './Text';
const CheckboxWithLabel: FC<CheckboxWithLabelProps> = ({
checkboxProps,
checked,
formControlLabelProps,
label,
onChange,
}) => {
const labelElement = useMemo(
() => (typeof label === 'string' ? <BodyText>{label}</BodyText> : label),
[label],
);
return (
<FormControlLabel
{...formControlLabelProps}
control={
<Checkbox {...checkboxProps} checked={checked} onChange={onChange} />
}
label={labelElement}
/>
);
};
export default CheckboxWithLabel;