import React from 'react'; import { clsx } from 'clsx'; import Checkbox from './Checkbox'; export interface CheckboxOption { value: string; label: string; description?: string; disabled?: boolean; } export interface CheckboxGroupProps { options: CheckboxOption[]; value?: string[]; onChange?: (value: string[]) => void; name: string; className?: string; orientation?: 'horizontal' | 'vertical'; label?: string; description?: string; error?: string; } /** * Checkbox group component */ export const CheckboxGroup = ({ options, value = [], onChange, name, className, orientation = 'vertical', label, description, error, }: CheckboxGroupProps) => { const handleChange = (optionValue: string, checked: boolean) => { if (!onChange) return; if (checked) { onChange([...value, optionValue]); } else { onChange(value.filter((v) => v !== optionValue)); } }; return (
{label && ( )} {description && (

{description}

)}
{options.map((option) => ( ))}
{error && (

{error}

)}
); };