Skip to main content

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​

Storybook

Inpatient Context​

Storybook

Bar Only​

Storybook

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​

VariantWhat it is
in rangeInk marker inside the green band.
low / highAmber marker outside the band.
criticalRed marker inside a red zone.
one-sided rangeeGFR ≥60 or LDL ≤99: band runs to the edge.
no headershowHeader={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​

PropTypeDefaultDescription
value *number | null—The result; required
measurestringnoneMeasure key (fmt.MEASURES or the range registry)
loincstringnoneLOINC code; finds the measure when `measure` is absent
unitstringthe measure's unitUCUM unit code
precisionnumberthe measure's precisionDecimals
refLownumberfrom the registryLab reference low; with `refHigh` it replaces the registry range
refHighnumberfrom the registryLab reference high
critLownumberfrom the registryCritical low
critHighnumberfrom the registryCritical high
minnumberauto (lowest edge or value, minus 12% padding)Bar start
maxnumberauto (highest edge or value, plus 12% padding)Bar end
labelstringthe measure labelLabel
showHeaderbooleantrueHeader row with label and value
widthnumber | string'100%'Width (px number or CSS length)
rangeContextRangeContextIdthe global context, else 'outpatient'Which shared reference range flags use; the lab range on a result still wins
defaultRangeContextRangeContextIdcontext, used only when no prop, provider or global context applies; default noneThe containing set's
ageYearsnumbernoneAge 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>
KindNameDescription
attributevalueThe result; required
attributemeasureMeasure key (fmt.MEASURES or the range registry); default none
attributeloincLOINC code; finds the measure when `measure` is absent; default none
attributeunitUCUM unit code; default the measure's unit
attributeprecisionDecimals; default the measure's precision
attributeref-low / refLowLab reference low; with `refHigh` it replaces the registry range; default from the registry
attributeref-high / refHighLab reference high; default from the registry
attributecrit-low / critLowCritical low; default from the registry
attributecrit-high / critHighCritical high; default from the registry
attributeminBar start; default auto (lowest edge or value, minus 12% padding)
attributemaxBar end; default auto (highest edge or value, plus 12% padding)
attributelabelLabel; default the measure label
attributeshow-header / showHeaderHeader row with label and value; default true
property / JSON attributewidthWidth (px number or CSS length); default '100%'
attributerange-context / rangeContextWhich shared reference range flags use; the lab range on a result still wins; default the global context, else 'outpatient'
attributedefault-range-context / defaultRangeContextThe containing set's default context, used only when no prop, provider or global context applies; default none
attributeage-years / ageYearsAge in years for the pediatric bands; default none
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus