Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Small Multiples Sparkline Stats Block for React

Six measures of a stationery shop as aligned sparkline rows in one framed panel on a shared month axis, with a guide that reads all six at the month under your pointer.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A small-multiples stats card for React with Base UI. A start-aligned header states the peak ("Orders peaked at 548 in December"), then one framed panel with + marks on its corners holds six rows divided by hairlines: orders, revenue, visitors, conversion, average basket and returns. Each row is a name, a line in a single foreground weight with a faint fill, and the month's value. All six rows share one set of month labels under them, so a peak in one lines up with the peak in the rest. Move across the lines, drag, or use the arrow keys and one guide runs through all six rows while every value changes to the month under it; leaving puts the latest month back. Revenue is orders times the basket and conversion is orders over visitors, so the rows always agree. For shops, product analytics and any report where several measures follow one calendar. The frame is rail to rail, inset from the page lines.

FAQ

How do I change the measures and months?

Edit MONTHS and the lists above MEASURES (ORDERS, VISITORS, BASKET, RETURNS). A measure is a label, one reading per month and a function that writes a reading. Revenue and conversion are derived from the lists they depend on. Each series needs one reading per month; the axis, the dots and the guide follow MONTHS.

How does the guide work?

A native range input named Month lies unseen over the plot, so pointer, touch drag and the arrow, Home and End keys all work as they do on any slider. Moving the pointer over the plot also reads the month under it. On focus the guide appears with a focus ring around the plot, and its spoken value is the month followed by all six readings ("March: Orders 389, Revenue ...").

Do the rows share a scale?

They share the time axis, not the vertical scale: each line runs from its own lowest reading to its own highest, so a small measure such as returns is as readable as a big one such as revenue. The values at the end of each row say what the heights mean, and each line's accessible name gives its start, end, lowest and highest month.

Is it accessible?

Every row is a heading and its line is an image with a text name; the values are plain text. The range input is the one control, with an accessible name and a readable value. The line, the guide and the dots are hidden from assistive technology where the text already says the same thing. The chart is kept left to right in right-to-left pages, because time runs that way in every language.

How does it fit on a phone?

The value moves under each row's name so the lines keep their width, and the axis shows every other month. Touch drags across the plot read a month, while vertical swipes still scroll the page. Nothing scrolls sideways at 320 pixels.

What happens with reduced motion?

The lines draw in once on load, and the guide fades in and out. With reduced motion both are instant; reading a month never animates.

  • Pro

    Sparkline Stats

    Sparklines

    Three sparkline cells for a web-analytics tool, each with its figure for the last seven days, its change on the seven before and thirty days of line under a soft fade.

  • Pro

    Six web-vitals tiles in one hairline frame, each with a fourteen-day line, its low and high marked by ticks, and a Sort by switch that re-orders them by change, budget used or volatility.

  • Pro

    Three ratings metrics for an app-store tracker in cells that share their hairlines, each with a twelve-week line filled beneath it when it climbs and above it when it falls.

  • Pro

    A week-on-week traffic comparison with two sparklines drawn on one shared scale, so the two weeks can be compared by eye.

  • Pro

    A hero figure for a cash-planning tool beside its own 90-day trend: the runway in months at the start, and a wide line with its high, its low and today marked.

  • Pro

    Sparkline Tile Grid Stats

    KPI bands and tiles

    Four KPI tiles for a subscription-box company, each holding the same twelve weeks as an area sparkline, with one slider that moves a cursor through all four and rewrites their values to the chosen week.