SOAPSection
ComplexOrders and notes
<co-soap-section>SOAPSection is one note section with AI draft, smart-phrase insert, required tag and error, or custom content.
import { SOAPSection } from 'health-components';
Examples
Note Sections
With Error
Read Only
Custom Content
Usage
<SOAPSection title="Plan" macros={[".diabetesplan", ".followup3m"]} required />
When to use
- Inside VisitNoteEditor or a custom note layout.
When not to use
- Short single fields: TextField.
Variants and states
| Variant | What it is |
|---|---|
| text | Default textarea. |
| ai | AI Scribe draft on top. |
| macros | Insert popover with smart phrases. |
| custom | children replace the textarea, such as a ScoreQuestionnaire. |
Accessibility
- Textarea named by the section title.
Do and don't
- Do: Keep text when templates switch.
- Don't: Auto-accept AI text.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
title * | string | — | Section title ("Subtitle", "Plan"); also names the textarea. Required |
text | string | "" | Initial section text (uncontrolled) |
value | string | undefined (uncontrolled) | Controlled section text |
onChange | (text: string) => void | none | Called with the new text (typing, smart phrase, accepted AI draft) |
ai | string | none | AI Scribe draft shown above the textarea with Accept and Edit |
onAcceptAI | (draft: string) => void | none | Called after the AI draft is accepted into the text |
macros | string[] | none | Smart phrases offered in the Insert popover (string[]) |
onInsertMacro | (macro: string) => void | none | Called with the smart phrase inserted into the text |
required | boolean | false | Shows the Required tag and marks the textarea required |
error | string | none | Error message under the textarea |
readOnly | boolean | false | Read-only lock state of the textarea |
rows | number | 3 | Textarea rows |
children | ReactNode | none | Custom content that replaces the textarea, such as a ScoreQuestionnaire |
Also accepts native attributes, including defaultChecked, autoFocus, onInput, plus className and event handlers on the root element.
Angular, Vue and HTML
Register the elements once (Angular guide), then use <co-soap-section>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.
Angular template
<co-soap-section title="…" text="…" [macros]="macros" (co-change)="onChange($event.detail)">…</co-soap-section>
| Kind | Name | Description |
|---|---|---|
| attribute | title | Section title ("Subtitle", "Plan"); also names the textarea. Required |
| attribute | text | Initial section text (uncontrolled); default "" |
| attribute | value | Controlled section text; default undefined (uncontrolled) |
| attribute | ai | AI Scribe draft shown above the textarea with Accept and Edit; default none |
| property / JSON attribute | macros | Smart phrases offered in the Insert popover (string[]); default none |
| attribute | required | Shows the Required tag and marks the textarea required; default false |
| attribute | error | Error message under the textarea; default none |
| attribute | read-only / readOnly | Read-only lock state of the textarea; default false |
| attribute | rows | Textarea rows; default 3 |
| attribute | default-checked / defaultChecked | |
| attribute | auto-focus / autoFocus | |
| event | co-change | Called with the new text (typing, smart phrase, accepted AI draft); default none (React: onChange) |
| event | co-accept-a-i | Called after the AI draft is accepted into the text; default none (React: onAcceptAI) |
| event | co-insert-macro | Called with the smart phrase inserted into the text; default none (React: onInsertMacro) |
| event | co-input | (React: onInput) |
| slot | (default) | Custom content that replaces the textarea, such as a ScoreQuestionnaire; default none |