Chart States

Loading skeletons, empty states and error states for every chart — one wrapper, six skeleton shapes, and a frame height that never shifts between them.

Every state, same frame height

@spectrumui/chart-states

Signup cohort retention

Loading chart data
Signup cohort retention — retention by cohort and month
CohortUsersMonth 0Month 1Month 2Month 3Month 4Month 5Month 6Month 7Month 8Month 9Month 10Month 11
Sep 2025674100.0%60.8%58.7%53.5%51.0%47.3%42.8%39.0%37.7%36.0%34.7%33.2%
Oct 20251150100.0%62.7%61.1%56.6%54.1%50.9%48.0%45.2%42.7%41.9%38.5%
Nov 2025764100.0%55.6%54.3%52.6%51.0%47.8%46.9%45.5%43.5%42.6%
Dec 2025855100.0%63.7%63.2%62.9%59.0%58.3%54.4%53.9%52.1%
Jan 20261245100.0%66.4%66.1%62.8%61.5%59.1%56.1%55.8%
Feb 20261566100.0%64.5%63.3%62.9%62.2%59.6%57.8%
Mar 20261450100.0%65.3%65.0%64.6%64.3%62.1%
Apr 20261021100.0%63.7%63.3%63.0%62.1%
May 20261538100.0%59.1%58.8%58.5%
Jun 20261207100.0%58.0%57.7%
Jul 20261781100.0%59.1%
Aug 20261290100.0%

Skeleton variants

variant="bars"

bar, candle, volume, histogram

variant="line"

line, area, price, depth

variant="grid"

calendar, cohort, heatmap

variant="rows"

order book, cohort, tables

variant="arc"

radial, progress

variant="cards"

stat cards, KPI tiles

Empty and error

empty

no data, nothing broken

No events in this range

Widen the date range, or send your first event to start populating this chart.

error

retry is part of the state

Could not load analytics

The metrics API returned a 503. This is usually transient.

Wrapping your own chart

ChartState

wrap anything

Nothing tracked yet

Install the SDK and your first session will show up here.

Manual installation

Prefer to copy by hand? Open the Code tab on any example above and switch to the file you need — every source file is there, not just the demo. Drop them in your project like this:

  • chart-engine.tsxcomponents/spectrumui/charts/chart-engine.tsx
  • cohort-chart.tsxcomponents/spectrumui/charts/cohort-chart.tsx
  • chart-states.tsxcomponents/spectrumui/charts/chart-states.tsx

There is nothing to install — this chart draws its own SVG and imports only @/lib/utils.

Usage

import { ChartStatusSwitcher } from '@/components/spectrumui/charts/chart-states';

<ChartStatusSwitcher />
  • ChartState wraps anything, not just Spectrum charts — give it a height and a skeleton variant.
  • The frame height is identical in all four states, so nothing shifts when data lands.