import Checkbox from "../Checkbox";
import type { CheckboxGroupViewProps } from "./CheckboxGroup.types";
export function CheckboxGroupView({
groupId,
value,
mode,
disabled,
options,
className,
ariaLabel,
onOptionChange,
}: CheckboxGroupViewProps) {
return (
{options.map((option) => {
const isChecked = value.includes(option.value);
// If there's subtext, render checkbox without label and handle layout separately
if (option.subtext) {
return (
{
onOptionChange(option.value, checked);
}}
/>
{option.label}
{option.subtext}
);
}
// If no subtext, use Checkbox's built-in label
return (
{
onOptionChange(option.value, checked);
}}
/>
);
})}
);
}