SigBuilder
ComplexMedications
<co-sig-builder>SigBuilder builds the directions from dose, route, frequency and duration and shows the plain-language sig the patient will read.
import { SigBuilder } from 'health-components';
Examples
Maintenance
Empty
Controlled
Usage
<SigBuilder value={{ dose: "1 tablet", route: "by mouth", freq: "twice daily", qty: 60, refills: 3 }} />
When to use
- Every new prescription.
When not to use
- Free-text only sigs.
Variants and states
| Variant | What it is |
|---|---|
| default | Structured fields with live preview. |
| C-II | Refills helper says none allowed. |
Accessibility
- Preview is text, read by screen readers.
Do and don't
- Do: Spell out frequency words.
- Don't: Latin abbreviations.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | Sig | — | {dose, route, freq, duration?, prn?, qty, refills, schedule?}. Controlled when `onChange` is set; without `onChange` it seeds the fields, as the design system README uses it |
defaultValue | Sig | {} | Initial sig (uncontrolled) |
onChange | (sig: Sig) => void | none | Called with the whole sig on every edit |
routes | string[] | by mouth, under the tongue, topically, inhaled, by injection | Route choices |
frequencies | string[] | once daily ... at bedtime | Frequency choices, spelled out |
Also accepts native attributes, including defaultChecked, autoFocus, plus className and event handlers on the root element.
Angular, Vue and HTML
Register the elements once (Angular guide), then use <co-sig-builder>. 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-sig-builder default-checked auto-focus [value]="value" (co-change)="onChange($event.detail)"></co-sig-builder>
| Kind | Name | Description |
|---|---|---|
| property / JSON attribute | value | {dose, route, freq, duration?, prn?, qty, refills, schedule?}. Controlled when `onChange` is set; without `onChange` it seeds the fields, as the design system README uses it; default {} |
| property / JSON attribute | default-value / defaultValue | Initial sig (uncontrolled); default {} |
| property / JSON attribute | routes | Route choices; default by mouth, under the tongue, topically, inhaled, by injection |
| property / JSON attribute | frequencies | Frequency choices, spelled out; default once daily ... at bedtime |
| attribute | default-checked / defaultChecked | |
| attribute | auto-focus / autoFocus | |
| event | co-change | Called with the whole sig on every edit; default none (React: onChange) |