Skip to main content

ProgressBar

BasicData display<co-progress-bar>

ProgressBar shows progress of a task or how much of an allowance is used, such as PA units used 12 of 20.

import { ProgressBar } from 'health-components';

Examples​

Showcase​

Storybook

Thresholds​

Storybook

Compact​

Storybook

Large​

Storybook

Usage​

<ProgressBar label="PA units used" value={12} max={20} unit="visits" meter thresholds={[75, 90]} />

When to use​

  • Authorized units or visits used, upload progress, onboarding completeness.

When not to use​

  • Unknown duration: Spinner.

Variants and states​

VariantWhat it is
progressrole progressbar.
meterrole meter, for allowances.
thresholdsTurns warning then danger at set percentages.
tonesprimary, success, warning, danger, ai.
compactBar only, for tables and file rows.
lg12px.

Accessibility​

  • aria-valuenow, valuemax and a valuetext in words.
  • The number is always shown as text too.

Do and don't​

  • Do: "12 of 20 visits used" with "Expires 12/31/2026" helper.
  • Don't: A bar with no number.

Props​

PropTypeDefaultDescription
value *number—Current value. Required
maxnumber100Maximum value
label *string—Visible label and accessible name. Required
unitstringnone (percent)Unit word: "visits" gives "12 of 20 visits used"
valueTextstringauto (percent, or "12 of 20 visits used")Value text shown and announced
meterbooleanfalseUses role meter (an amount used of an allowance) instead of progressbar
thresholdsreadonly [warn: number, danger: number]none[warnPct, dangerPct]: the bar turns warning and danger at these percentages
toneProgressToneauto (from thresholds, else primary)'primary' | 'success' | 'warning' | 'danger' | 'ai'
compactbooleanfalseBar only, without the header and helper
size'md' | 'lg''md''md' 8px | 'lg' 12px bar
helperReactNodenoneHelper text under the bar

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-progress-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-progress-bar value="…" max="…" [thresholds]="thresholds"></co-progress-bar>
KindNameDescription
attributevalueCurrent value. Required
attributemaxMaximum value; default 100
attributelabelVisible label and accessible name. Required
attributeunitUnit word: "visits" gives "12 of 20 visits used"; default none (percent)
attributevalue-text / valueTextValue text shown and announced; default auto (percent, or "12 of 20 visits used")
attributemeterUses role meter (an amount used of an allowance) instead of progressbar; default false
property / JSON attributethresholds[warnPct, dangerPct]: the bar turns warning and danger at these percentages; default none
attributetone'primary' | 'success' | 'warning' | 'danger' | 'ai'; default auto (from thresholds, else primary)
attributecompactBar only, without the header and helper; default false
attributesize'md' 8px | 'lg' 12px bar; default 'md'
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus
slothelperHelper text under the bar; default none Plain text also works as the `helper` attribute.