Skip to main content

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​

Storybook

With Error​

Storybook

Read Only​

Storybook

Custom Content​

Storybook

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​

VariantWhat it is
textDefault textarea.
aiAI Scribe draft on top.
macrosInsert popover with smart phrases.
customchildren 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​

PropTypeDefaultDescription
title *string—Section title ("Subtitle", "Plan"); also names the textarea. Required
textstring""Initial section text (uncontrolled)
valuestringundefined (uncontrolled)Controlled section text
onChange(text: string) => voidnoneCalled with the new text (typing, smart phrase, accepted AI draft)
aistringnoneAI Scribe draft shown above the textarea with Accept and Edit
onAcceptAI(draft: string) => voidnoneCalled after the AI draft is accepted into the text
macrosstring[]noneSmart phrases offered in the Insert popover (string[])
onInsertMacro(macro: string) => voidnoneCalled with the smart phrase inserted into the text
requiredbooleanfalseShows the Required tag and marks the textarea required
errorstringnoneError message under the textarea
readOnlybooleanfalseRead-only lock state of the textarea
rowsnumber3Textarea rows
childrenReactNodenoneCustom 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>
KindNameDescription
attributetitleSection title ("Subtitle", "Plan"); also names the textarea. Required
attributetextInitial section text (uncontrolled); default ""
attributevalueControlled section text; default undefined (uncontrolled)
attributeaiAI Scribe draft shown above the textarea with Accept and Edit; default none
property / JSON attributemacrosSmart phrases offered in the Insert popover (string[]); default none
attributerequiredShows the Required tag and marks the textarea required; default false
attributeerrorError message under the textarea; default none
attributeread-only / readOnlyRead-only lock state of the textarea; default false
attributerowsTextarea rows; default 3
attributedefault-checked / defaultChecked
attributeauto-focus / autoFocus
eventco-changeCalled with the new text (typing, smart phrase, accepted AI draft); default none (React: onChange)
eventco-accept-a-iCalled after the AI draft is accepted into the text; default none (React: onAcceptAI)
eventco-insert-macroCalled with the smart phrase inserted into the text; default none (React: onInsertMacro)
eventco-input (React: onInput)
slot(default)Custom content that replaces the textarea, such as a ScoreQuestionnaire; default none