StealThis .dev

Widget — Empty / loading widget states

A single dashboard widget shown through its full lifecycle for the fictional Meridian Ops workspace — a shimmering skeleton while data loads, a no-data-yet empty state with an inline-SVG illustration and connect-a-source CTA, an error state with a retry button and request details, and a loaded state with a real inline-SVG bar chart, KPI value, delta chip and sparkline. A segmented control cycles all four, while Simulate load runs a true loading-to-loaded sequence and the loaded chart ticks live. Pure vanilla, no chart libraries.

Open in Lab
html css vanilla-js
Targets: JS HTML

Code

Empty / loading widget states

A reference for the four states every data widget needs to handle gracefully. One Active sessions card on the fictional Meridian Ops board is driven through loading, empty, error, and loaded — each with its own polished treatment: a shimmering skeleton (KPI line, bars, footer), a no-data illustration with a Connect a source CTA, an error panel with a Retry button and the failing request, and a fully rendered state with a KPI headline, an up/down delta chip, a sparkline, and an inline-SVG bar chart of sessions per hour. Two static reference widgets (an error-budget donut and a p95 latency area line) round out the board.

A segmented control in the header switches the live widget between states instantly, and a matching overflow menu inside the card does the same from the ⋯ button. Simulate load runs the real sequence — it drops into the shimmering skeleton, waits, then animates into the loaded chart and fires a toast — and the empty-state CTA and error Retry both route through that same loading path so the transitions stay honest.

Once loaded, the bar chart and KPI tick on a timer so the board feels live, with the peak hour highlighted and per-bar tooltips. Everything is keyboard-operable with visible focus rings and prefers-reduced-motion support; the layout uses landmark roles, collapses from a twelve-column grid to a single column, and swaps in off-canvas navigation below ~920px. No chart libraries, no images, no placeholder gray boxes — just inline SVG and CSS.