Skip to main content

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​

Storybook

Loading​

Storybook

Empty Period​

Storybook

With Actions​

Storybook

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​

VariantWhat it is
periods7d, 30d, 90d switch.
loadingSkeleton card.
emptyEmpty state with text.
sourceMuted 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​

PropTypeDefaultDescription
title *string—Card title, what the chart shows ("Denials by payer"). Required
subtitleReactNodenoneLine under the title
periodsstring[]nonePeriod choices shown as a small SegmentedControl ("7d", "30d", "90d")
periodstringuncontrolledSelected period (controlled)
defaultPeriodstringthe first periodInitially selected period (uncontrolled)
onPeriod(period: string) => voidnone(p) => void: called with the new period
loadingbooleanfalseShows a skeleton instead of the chart
emptystringnoneEmpty message; shows an EmptyState instead of the chart
sourceReactNodenoneMuted line naming the data source and time
actionsReactNodenoneHeader actions, shown after the period switch
childrenReactNode—The chart.
flatbooleanfalseBorder instead of shadow
paddingCardPadding'default''default' | 'compact' (10px) | 'none' (edge-to-edge tables)
footerReactNodenoneFooter content
asElementType'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>
KindNameDescription
attributetitleCard title, what the chart shows ("Denials by payer"). Required
property / JSON attributeperiodsPeriod choices shown as a small SegmentedControl ("7d", "30d", "90d"); default none
attributeperiodSelected period (controlled); default uncontrolled
attributedefault-period / defaultPeriodInitially selected period (uncontrolled); default the first period
attributeloadingShows a skeleton instead of the chart; default false
attributeemptyEmpty message; shows an EmptyState instead of the chart; default none
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus
attributeflatBorder instead of shadow; default false
attributepadding'default' | 'compact' (10px) | 'none' (edge-to-edge tables); default 'default'
property / JSON attributeasRoot tag name; default 'section'
eventco-period(p) => void: called with the new period; default none (React: onPeriod)
slotsubtitleLine under the title; default none Plain text also works as the `subtitle` attribute.
slotsourceMuted line naming the data source and time; default none Plain text also works as the `source` attribute.
slotactionsHeader actions, shown after the period switch; default none Plain text also works as the `actions` attribute.
slot(default)The chart.
slotfooterFooter content; default none Plain text also works as the `footer` attribute.