# CheckboxGroup

A named multiple-choice group with a shared array value and native form behavior.

Connect Flood once using [the installation guide](https://flood.md/docs/installation). Then import the components you use; no per-component add command is needed.

## Example

```tsx
"use client";

import { FloodRoot, CheckboxGroup } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <CheckboxGroup name="notifications" legend="Notifications" options={[{ value: "updates", label: "Product updates" }, { value: "releases", label: "Release notes" }]} defaultValue={["updates"]} />
    </FloodRoot>
  );
}
```

## Design notes

- Composes Fieldset and existing native choice controls. The ref targets HTMLFieldSetElement; options need unique values and visible labels.
- value/onValueChange is controlled; defaultValue initializes an uncontrolled group. Native form reset restores uncontrolled defaults without firing onValueChange; controlled values remain owned by the host.
- name belongs to the inputs. The form prop associates every input with an external form. Disabled options and groups follow native submission rules.
- CheckboxGroup has no required/min/max shortcut: a required checkbox means that specific checkbox. Validate the selected array in the host and use group status/message.

## API reference

| Prop | Values | Default |
| --- | --- | --- |
| `legend` | `ReactNode` | `Required` |
| `legendSize · 0.2.10` | `"label" \| "section"` | `—` |
| `hideLabel · 0.2.3` | `boolean` | `—` |
| `hint` | `ReactNode` | `—` |
| `error` | `ReactNode` | `—` |
| `message` | `ReactNode` | `—` |
| `status` | `"error" \| "warning" \| "success" \| "info"` | `—` |
| `name` | `string` | `Required` |
| `options` | `readonly ChoiceOption[]` | `Required` |
| `value` | `readonly string[]` | `—` |
| `defaultValue` | `readonly string[]` | `[]` |
| `onValueChange` | `(value: string[]) => void` | `—` |
| `orientation` | `"vertical" \| "horizontal"` | `"vertical"` |
| `Native HTML props` | `Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, "children" \| "defaultValue" \| "role">` | `Forwarded` |
