Files
omni-tools/src/components/options/CheckboxWithDesc.tsx

43 lines
849 B
TypeScript
Raw Normal View History

2024-06-23 15:14:14 +01:00
import React from 'react';
import { Box, Checkbox, FormControlLabel, Typography } from '@mui/material';
const CheckboxWithDesc = ({
title,
description,
checked,
onChange,
disabled
2024-06-23 15:14:14 +01:00
}: {
title: string;
2025-03-09 17:45:13 +00:00
description?: string;
2024-06-23 15:14:14 +01:00
checked: boolean;
onChange: (value: boolean) => void;
disabled?: boolean;
2024-06-23 15:14:14 +01:00
}) => {
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
onChange(event.target.checked);
};
return (
<Box>
<FormControlLabel
control={
<Checkbox
checked={checked}
onChange={handleChange}
disabled={disabled}
/>
2024-06-23 15:14:14 +01:00
}
label={title}
/>
2025-03-09 17:45:13 +00:00
{description && (
<Typography fontSize={12} mt={1}>
{description}
</Typography>
)}
2024-06-23 15:14:14 +01:00
</Box>
);
};
export default CheckboxWithDesc;