DoseDisplay
ComplexClinical values
<co-dose-display>DoseDisplay writes a medication dose the ISMP way: tall-man drug names, leading zero, no trailing zero, and units, mcg and mL spelled safely.
import { DoseDisplay } from 'health-components';
Examples
Doses
Inline
Usage
<DoseDisplay drug="hydroxyzine" strength={25} unit="mg" form="tablet" amount={25} route="PO" frequency="every 6 hours" prn prnReason="itching" lookAlike="hydralazine" />
When to use
- Medication lists, MAR rows, order review, prescription preview, discharge instructions.
When not to use
- Lab or vital values: ClinicalValue.
- Free-text sigs from outside sources: show verbatim and label as external.
Variants and states
| Variant | What it is |
|---|---|
| stacked | Drug and strength above, dose and sig below (default). |
| inline | One line for tables. |
| highAlert | Red High-alert badge (insulin, heparin, opioids). |
| lookAlike | Amber badge naming the look-alike drug. |
| weight-based | perKg and weightKg show the calculation. |
Accessibility
- Tall-man capitals are read normally by screen readers; the visual cue is for sighted readers.
- Badges carry text, not colour alone.
Do and don't
- Do: Pass numbers; let fmt drop the trailing zero.
- Don't: Write "U", "IU", "cc", "µg" or ".5" anywhere on screen.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
drug * | string | — | Drug name; tall-man lettering is applied automatically; required |
amount * | number | string | — | Dose amount (a number, or a string such as '.5' that is parsed); required |
unit * | string | — | Dose unit: mg, mcg, g, units, mL, mEq... ('U', 'IU', 'ug', 'cc' are rewritten safely); required |
strength | number | none | Product strength |
strengthUnit | string | `unit` | Strength unit |
form | string | none | Dose form ('tablet', 'per 5 mL suspension') |
route | string | none | Route ('PO', 'IV', 'subcut') |
frequency | string | none | Frequency ('every 6 hours') |
prn | boolean | false | As needed |
prnReason | string | none | PRN reason ('itching') |
perKg | number | none | Dose per kg, shown with `weightKg` as the calculation |
weightKg | number | none | Weight used for the calculation, kg |
highAlert | boolean | false | ISMP high-alert medication: red High-alert badge |
lookAlike | string | none | Look-alike drug name: amber badge |
layout | DoseDisplayLayout | 'stacked' | 'stacked' (drug above, dose and sig below) | 'inline' (one line for tables) |
Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.
Angular, Vue and HTML
Register the elements once (Angular guide), then use <co-dose-display>. 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-dose-display drug="…" unit="…" [amount]="amount"></co-dose-display>
| Kind | Name | Description |
|---|---|---|
| attribute | drug | Drug name; tall-man lettering is applied automatically; required |
| property / JSON attribute | amount | Dose amount (a number, or a string such as '.5' that is parsed); required |
| attribute | unit | Dose unit: mg, mcg, g, units, mL, mEq... ('U', 'IU', 'ug', 'cc' are rewritten safely); required |
| attribute | strength | Product strength; default none |
| attribute | strength-unit / strengthUnit | Strength unit; default `unit` |
| attribute | form | Dose form ('tablet', 'per 5 mL suspension'); default none |
| attribute | route | Route ('PO', 'IV', 'subcut'); default none |
| attribute | frequency | Frequency ('every 6 hours'); default none |
| attribute | prn | As needed; default false |
| attribute | prn-reason / prnReason | PRN reason ('itching'); default none |
| attribute | per-kg / perKg | Dose per kg, shown with `weightKg` as the calculation; default none |
| attribute | weight-kg / weightKg | Weight used for the calculation, kg; default none |
| attribute | high-alert / highAlert | ISMP high-alert medication: red High-alert badge; default false |
| attribute | look-alike / lookAlike | Look-alike drug name: amber badge; default none |
| attribute | layout | 'stacked' (drug above, dose and sig below) | 'inline' (one line for tables); default 'stacked' |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus |