Files
temetro/.agents/skills/coss/references/primitives/toolbar.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

2.2 KiB

coss Toolbar

When to use

  • Grouped command/action strips.
  • Editor-like tool controls and mode toggles.

Install

npx shadcn@latest add @coss/toolbar

Manual deps from docs:

npm install @base-ui/react

Canonical imports

import { Button } from "@/components/ui/button"
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"
import {
  Toolbar,
  ToolbarButton,
  ToolbarGroup,
  ToolbarSeparator,
} from "@/components/ui/toolbar"

Minimal pattern

<Toolbar>
  <ToggleGroup className="border-none p-0" defaultValue={["left"]}>
    <ToolbarButton aria-label="Align left" render={<ToggleGroupItem value="left" />}>
      <AlignLeftIcon />
    </ToolbarButton>
    <ToolbarButton aria-label="Align center" render={<ToggleGroupItem value="center" />}>
      <AlignCenterIcon />
    </ToolbarButton>
  </ToggleGroup>
  <ToolbarSeparator />
  <ToolbarGroup>
    <ToolbarButton render={<Button type="button" variant="outline" />}>
      Save
    </ToolbarButton>
  </ToolbarGroup>
</Toolbar>

Patterns from coss particles

  • Part composition via render: use ToolbarButton render={<ToggleGroupItem ... />} or render={<Button ... />} instead of re-implementing button behavior.
  • Grouped layout: use ToolbarGroup boundaries with ToolbarSeparator between logical command clusters.
  • Icon-only controls: pair icon buttons with explicit aria-label; combine with Tooltip for discoverability.
  • Embedded selects: wrap SelectTrigger with ToolbarButton render={...} to keep visual consistency in mixed control bars.
  • Formatting rows: combine ToggleGroup + ToolbarButton for alignment/formatting command sets.

Common pitfalls

  • Dropping ToolbarSeparator, causing unrelated command clusters to collapse visually.
  • Missing aria-label on icon-only toolbar actions.
  • Rendering raw Button/ToggleGroupItem next to toolbar controls without ToolbarButton, creating inconsistent density/spacing.
  • Treating Toolbar as a state manager; control selection/toggle state through composed primitives (ToggleGroup, Select, etc.).

Useful particle references

  • core toolbar patterns: p-toolbar-1
  • related composition references: p-toggle-group-1, p-group-1, p-select-1