Files
Trilium/apps/client/src/widgets/react/FormCheckbox.tsx

23 lines
725 B
TypeScript
Raw Normal View History

2025-08-03 21:18:18 +03:00
interface FormCheckboxProps {
name: string;
label: string;
currentValue?: boolean;
onChange(newValue: boolean): void;
}
export default function FormCheckbox({ name, label, currentValue, onChange }: FormCheckboxProps) {
return (
<div className="form-check">
<label className="form-check-label tn-checkbox">
<input
className="form-check-input"
type="checkbox"
name={name}
checked={currentValue || false}
value="1"
onChange={e => onChange((e.target as HTMLInputElement).checked)} />
{label}
</label>
</div>
);
}