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
Thresholds
Compact
Large
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
| Variant | What it is |
|---|---|
| progress | role progressbar. |
| meter | role meter, for allowances. |
| thresholds | Turns warning then danger at set percentages. |
| tones | primary, success, warning, danger, ai. |
| compact | Bar only, for tables and file rows. |
| lg | 12px. |
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
| Prop | Type | Default | Description |
|---|---|---|---|
value * | number | — | Current value. Required |
max | number | 100 | Maximum value |
label * | string | — | Visible label and accessible name. Required |
unit | string | none (percent) | Unit word: "visits" gives "12 of 20 visits used" |
valueText | string | auto (percent, or "12 of 20 visits used") | Value text shown and announced |
meter | boolean | false | Uses role meter (an amount used of an allowance) instead of progressbar |
thresholds | readonly [warn: number, danger: number] | none | [warnPct, dangerPct]: the bar turns warning and danger at these percentages |
tone | ProgressTone | auto (from thresholds, else primary) | 'primary' | 'success' | 'warning' | 'danger' | 'ai' |
compact | boolean | false | Bar only, without the header and helper |
size | 'md' | 'lg' | 'md' | 'md' 8px | 'lg' 12px bar |
helper | ReactNode | none | Helper 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>
| Kind | Name | Description |
|---|---|---|
| attribute | value | Current value. Required |
| attribute | max | Maximum value; default 100 |
| attribute | label | Visible label and accessible name. Required |
| attribute | unit | Unit word: "visits" gives "12 of 20 visits used"; default none (percent) |
| attribute | value-text / valueText | Value text shown and announced; default auto (percent, or "12 of 20 visits used") |
| attribute | meter | Uses role meter (an amount used of an allowance) instead of progressbar; default false |
| property / JSON attribute | thresholds | [warnPct, dangerPct]: the bar turns warning and danger at these percentages; default none |
| attribute | tone | 'primary' | 'success' | 'warning' | 'danger' | 'ai'; default auto (from thresholds, else primary) |
| attribute | compact | Bar only, without the header and helper; default false |
| attribute | size | 'md' 8px | 'lg' 12px bar; default 'md' |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus | |
| slot | helper | Helper text under the bar; default none Plain text also works as the `helper` attribute. |