Skip to main content

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​

Storybook

Empty​

Storybook

Controlled​

Storybook

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​

VariantWhat it is
defaultStructured fields with live preview.
C-IIRefills 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​

PropTypeDefaultDescription
valueSig—{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
defaultValueSig{}Initial sig (uncontrolled)
onChange(sig: Sig) => voidnoneCalled with the whole sig on every edit
routesstring[]by mouth, under the tongue, topically, inhaled, by injectionRoute choices
frequenciesstring[]once daily ... at bedtimeFrequency 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>
KindNameDescription
property / JSON attributevalue{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 attributedefault-value / defaultValueInitial sig (uncontrolled); default {}
property / JSON attributeroutesRoute choices; default by mouth, under the tongue, topically, inhaled, by injection
property / JSON attributefrequenciesFrequency choices, spelled out; default once daily ... at bedtime
attributedefault-checked / defaultChecked
attributeauto-focus / autoFocus
eventco-changeCalled with the whole sig on every edit; default none (React: onChange)