import { FormControlLabel, Checkbox } from '@mui/material';
import { FieldComponentProps } from '../../types/overrides';

export default function BooleanField({ field, value, onChange, disabled }: FieldComponentProps) {
  return (
    <FormControlLabel
      control={
        <Checkbox
          checked={!!value}
          onChange={(e) => onChange(e.target.checked)}
          disabled={disabled}
        />
      }
      label={field.label}
    />
  );
}
