import { useRef } from 'react'; import Label from './Label'; export interface CheckboxProps { id?: string label?: string required?: boolean disabled?: boolean widthClass?: string tooltip?: string value?: boolean onChange?: (event: React.ChangeEvent) => void } function Checkbox({ id, required, disabled, tooltip, label, widthClass = 'w-full', value, onChange }: CheckboxProps) { const inputRef = useRef(null); const cursor = disabled ? 'cursor-not-allowed' : 'cursor-pointer'; function handleLabelClick(event: React.MouseEvent): void { event.preventDefault(); if (!disabled) { inputRef.current?.click(); } } return (
{ label &&
); } export default Checkbox;