ReferenceRangeBar
ComplexClinical values
<co-reference-range-bar>ReferenceRangeBar places a result on a bar showing the normal band and critical zones, so distance from normal reads at a glance.
import { ReferenceRangeBar } from 'health-components';
Examples
Results
Inpatient Context
Bar Only
Usage
<ReferenceRangeBar measure="potassium" value={5.4} />
When to use
- Result detail drawers, patient-facing result views, trend reviews.
When not to use
- Dense tables: use ClinicalValue with its tooltip.
- Results with no numeric range.
Variants and states
| Variant | What it is |
|---|---|
| in range | Ink marker inside the green band. |
| low / high | Amber marker outside the band. |
| critical | Red marker inside a red zone. |
| one-sided range | eGFR ≥60 or LDL ≤99: band runs to the edge. |
| no header | showHeader={false} for the bar only. |
Accessibility
- The bar is role img with one sentence: name, value, unit, range and flag.
- Marker colour repeats the flag; the header shows the flag letter and icon.
Do and don't
- Do: Pass the lab range when it differs from the sample.
- Don't: Use it for values with no range; it implies a normal band.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value * | number | null | — | The result; required |
measure | string | none | Measure key (fmt.MEASURES or the range registry) |
loinc | string | none | LOINC code; finds the measure when `measure` is absent |
unit | string | the measure's unit | UCUM unit code |
precision | number | the measure's precision | Decimals |
refLow | number | from the registry | Lab reference low; with `refHigh` it replaces the registry range |
refHigh | number | from the registry | Lab reference high |
critLow | number | from the registry | Critical low |
critHigh | number | from the registry | Critical high |
min | number | auto (lowest edge or value, minus 12% padding) | Bar start |
max | number | auto (highest edge or value, plus 12% padding) | Bar end |
label | string | the measure label | Label |
showHeader | boolean | true | Header row with label and value |
width | number | string | '100%' | Width (px number or CSS length) |
rangeContext | RangeContextId | the global context, else 'outpatient' | Which shared reference range flags use; the lab range on a result still wins |
defaultRangeContext | RangeContextId | context, used only when no prop, provider or global context applies; default none | The containing set's |
ageYears | number | none | Age in years for the pediatric bands |
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-reference-range-bar>. 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-reference-range-bar value="…" measure="…" [width]="width"></co-reference-range-bar>
| Kind | Name | Description |
|---|---|---|
| attribute | value | The result; required |
| attribute | measure | Measure key (fmt.MEASURES or the range registry); default none |
| attribute | loinc | LOINC code; finds the measure when `measure` is absent; default none |
| attribute | unit | UCUM unit code; default the measure's unit |
| attribute | precision | Decimals; default the measure's precision |
| attribute | ref-low / refLow | Lab reference low; with `refHigh` it replaces the registry range; default from the registry |
| attribute | ref-high / refHigh | Lab reference high; default from the registry |
| attribute | crit-low / critLow | Critical low; default from the registry |
| attribute | crit-high / critHigh | Critical high; default from the registry |
| attribute | min | Bar start; default auto (lowest edge or value, minus 12% padding) |
| attribute | max | Bar end; default auto (highest edge or value, plus 12% padding) |
| attribute | label | Label; default the measure label |
| attribute | show-header / showHeader | Header row with label and value; default true |
| property / JSON attribute | width | Width (px number or CSS length); default '100%' |
| attribute | range-context / rangeContext | Which shared reference range flags use; the lab range on a result still wins; default the global context, else 'outpatient' |
| attribute | default-range-context / defaultRangeContext | The containing set's default context, used only when no prop, provider or global context applies; default none |
| attribute | age-years / ageYears | Age in years for the pediatric bands; default none |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus |