ChartCard
ComplexDashboards
<co-chart-card>ChartCard wraps any chart in a Card with a title, period switch, loading and empty states, and a source line.
import { ChartCard } from 'health-components';
Examples
Showcase
Loading
Empty Period
With Actions
Usage
<ChartCard title="Denials by payer" periods={["7d", "30d", "90d"]} source="Source: ERA 835 files, posted 10/09/2026">
<BarChart data={denials} />
</ChartCard>
When to use
- Every chart on a dashboard.
When not to use
- A single number: StatCard.
Variants and states
| Variant | What it is |
|---|---|
| periods | 7d, 30d, 90d switch. |
| loading | Skeleton card. |
| empty | Empty state with text. |
| source | Muted line naming the data source and time. |
Accessibility
- Chart inside carries its own aria text.
Do and don't
- Do: Every number traces to a saved report: put it in source.
- Don't: A chart with no period.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
title * | string | — | Card title, what the chart shows ("Denials by payer"). Required |
subtitle | ReactNode | none | Line under the title |
periods | string[] | none | Period choices shown as a small SegmentedControl ("7d", "30d", "90d") |
period | string | uncontrolled | Selected period (controlled) |
defaultPeriod | string | the first period | Initially selected period (uncontrolled) |
onPeriod | (period: string) => void | none | (p) => void: called with the new period |
loading | boolean | false | Shows a skeleton instead of the chart |
empty | string | none | Empty message; shows an EmptyState instead of the chart |
source | ReactNode | none | Muted line naming the data source and time |
actions | ReactNode | none | Header actions, shown after the period switch |
children | ReactNode | — | The chart. |
flat | boolean | false | Border instead of shadow |
padding | CardPadding | 'default' | 'default' | 'compact' (10px) | 'none' (edge-to-edge tables) |
footer | ReactNode | none | Footer content |
as | ElementType | 'section' | Root tag name |
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-chart-card>. 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-chart-card title="…" period="…" [periods]="periods" (co-period)="onPeriod($event.detail)">…</co-chart-card>
| Kind | Name | Description |
|---|---|---|
| attribute | title | Card title, what the chart shows ("Denials by payer"). Required |
| property / JSON attribute | periods | Period choices shown as a small SegmentedControl ("7d", "30d", "90d"); default none |
| attribute | period | Selected period (controlled); default uncontrolled |
| attribute | default-period / defaultPeriod | Initially selected period (uncontrolled); default the first period |
| attribute | loading | Shows a skeleton instead of the chart; default false |
| attribute | empty | Empty message; shows an EmptyState instead of the chart; default none |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus | |
| attribute | flat | Border instead of shadow; default false |
| attribute | padding | 'default' | 'compact' (10px) | 'none' (edge-to-edge tables); default 'default' |
| property / JSON attribute | as | Root tag name; default 'section' |
| event | co-period | (p) => void: called with the new period; default none (React: onPeriod) |
| slot | subtitle | Line under the title; default none Plain text also works as the `subtitle` attribute. |
| slot | source | Muted line naming the data source and time; default none Plain text also works as the `source` attribute. |
| slot | actions | Header actions, shown after the period switch; default none Plain text also works as the `actions` attribute. |
| slot | (default) | The chart. |
| slot | footer | Footer content; default none Plain text also works as the `footer` attribute. |