Files
temetro/.agents/skills/coss/references/primitives/checkbox-group.md
T
Khalid Abdi 929bec8f31 feat: AI-added records save with placeholders + "Added by AI" provenance
Stop blocking AI imports/proposals on missing non-critical fields. Records
the chat agent drafts now save with safe placeholders, auto-generated file
numbers, and a source="ai" marker that surfaces an "Added by AI" badge so a
clinician can review/edit them later.

Backend:
- add `source` (manual|ai) column to patients/appointments/prescriptions
  (migration 0014) + canonical types, services, validation schemas
- relax patient/appointment validation: empty file number allowed, demographic
  + type/provider/initials fall back to placeholders (initials derived from name)
- patients.generateFileNumber() auto-assigns an MRN when one is missing
- proposeAppointment accepts a name when no file number resolves; AI commits +
  /api/ai/import stamp source="ai"

Frontend:
- `source` on Appointment/Patient/Prescription types; AI commits send source="ai"
- reusable <AiBadge> shown on the Patients table/detail and prescriptions list

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14 19:27:17 +03:00

1.9 KiB

coss Checkbox Group

When to use

  • Multi-select option groups with shared label context.
  • Collecting multiple values under one field name.

Install

npx shadcn@latest add @coss/checkbox-group

Manual deps from docs:

npm install @base-ui/react

Canonical imports

import { Checkbox } from "@/components/ui/checkbox"
import { CheckboxGroup } from "@/components/ui/checkbox-group"

Minimal pattern

<CheckboxGroup>
  <Label>
    <Checkbox defaultChecked />
    Next.js
  </Label>
  <Label>
    <Checkbox />
    Vite
  </Label>
  <Label>
    <Checkbox />
    Astro
  </Label>
</CheckboxGroup>

For form-bound option groups, prefer Field + Fieldset composition so legend, labels, and errors are grouped correctly.

Patterns from coss particles

Key patterns

Group with aria-label and defaultValue:

<CheckboxGroup aria-label="Select frameworks" defaultValue={["next"]}>
  <Label>
    <Checkbox value="next" />
    Next.js
  </Label>
  <Label>
    <Checkbox value="vite" />
    Vite
  </Label>
</CheckboxGroup>

Controlled group:

const [value, setValue] = useState(["next"])

<CheckboxGroup value={value} onValueChange={setValue}>
  ...
</CheckboxGroup>

For form-bound groups, use Field + Fieldset so legend, labels, and errors are grouped correctly.

More examples

See p-checkbox-group-1 through p-checkbox-group-5 for disabled items, parent checkbox, nested, and form patterns.

Common pitfalls

  • Using checkbox group when only one option should be selected.
  • Missing group label/legend context for assistive technology.
  • Incorrectly handling submitted values as scalar instead of array/list.

Useful particle references

  • with disabled item: p-checkbox-group-2
  • parent checkbox: p-checkbox-group-3
  • nested parent checkbox: p-checkbox-group-4
  • form integration: p-checkbox-group-5
  • form composition references: p-form-1, p-form-2, p-input-group-24