MoneyDisplay
BasicClinical values
<co-money-display>MoneyDisplay shows US dollar amounts with two decimals, grouping and tabular figures, and negative adjustments in parentheses.
import { MoneyDisplay } from 'health-components';
Examples
Statement
Balance Due
Usage
<MoneyDisplay value={-45} label="contractual adjustment" />
When to use
- Charges, payments, adjustments, balances, copays, estimates.
When not to use
- Counts or units of service: plain numbers.
Variants and states
| Variant | What it is |
|---|---|
| positive | $1,234.50. |
| negative | ($45.00), read as "minus $45.00". |
| zero | $0.00. |
| missing | En dash when there is no amount. |
| emphasis | Bold, for balance due. |
| align end | Right aligned for columns. |
Accessibility
- aria-label says "minus" for negatives; parentheses are not read reliably.
Do and don't
- Do: Right-align money columns.
- Don't: Use red alone for negatives.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value * | number | null | — | Amount in US dollars; null shows an en dash (no amount); required |
emphasis | boolean | false | Bold, for balance due |
align | 'start' | 'end' | 'start' | 'start' | 'end' (right aligned for columns) |
label | string | none | Appended to the spoken text ('contractual adjustment') |
minWidth | number | 90 | Column width in px when `align` is 'end' |
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-money-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-money-display value="…" emphasis [defaultValue]="defaultValue"></co-money-display>
| Kind | Name | Description |
|---|---|---|
| attribute | value | Amount in US dollars; null shows an en dash (no amount); required |
| attribute | emphasis | Bold, for balance due; default false |
| attribute | align | 'start' | 'end' (right aligned for columns); default 'start' |
| attribute | label | Appended to the spoken text ('contractual adjustment'); default none |
| attribute | min-width / minWidth | Column width in px when `align` is 'end'; default 90 |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus |