Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Compact KPI Tile Grid Stats Block for React

Six dense KPI tiles for a café group in one hairline frame, with a Day, Week and Month switch that re-reads all six figures and rolls their digits.

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 compact KPI tile grid for React with Base UI. A start-aligned header has a Day, Week and Month switch at its end, and a line under the sentence that says what you're reading ("This week, compared with last week"). Under it, six tiles share their hairlines inside one frame with + marks on its corners: each is a value in text-lg, its change next to it and its label in text-xs under both. Switching the period re-reads all six at once: every digit of every value and every change rolls to its new number, and the line under the header announces the new period. The figures (net sales, orders, average ticket, oat-milk share, wait for a drink and refunds) come from one typed table of readings per period; the average ticket is sales divided by orders, so the tiles always agree. Six across from xl, three by two below, two by three on a phone. For a point-of-sale, retail or operations page where a lot of numbers need to fit in a small band.

FAQ

How do I change the figures or add a period?

Edit PERIODS and the readings at the top of the file (SALES, ORDERS, OAT, WAIT, REFUNDS). Each reading list holds one { before, now } pair per period, in the order of PERIODS; a change is computed from the pair, as a share of before (+6.2%) or as a difference in the unit you set (−0.5 min). Add a period by adding one entry to PERIODS and one pair to every reading list; the switch gets a segment, and you widen its grid-cols-3. Periods are named by what they are ("This week"), never by a date.

How does the period switch work?

It is the catalog's Segment Group, a single-choice control with arrow-key movement between segments, wired to one piece of state. The six tiles keep their keys, so each digit of each Sliding Number rolls from the number it shows to the next one. The line under the header is a polite live region, so a screen reader hears the new period once; the six values aren't read out one by one.

Why aren't rises green and falls red?

Whether a change is good depends on the figure: a longer wait is bad, a higher average ticket is good. The block shows direction with an arrow and a sign, in the text colour, and leaves the judgement to the reader, which also keeps it correct in every theme preset.

Is it accessible?

Yes. The tiles are a description list: each label is a term, and the value and the change are its descriptions. Values are drawn first but read after their label. Digits that roll are read as the final number: each one has a visually hidden copy. Values sit in bdi elements and signed changes are kept left to right for right-to-left pages. With reduced motion the digits change in place.

How does it fit on a phone?

The switch takes the full width under the header, and the tiles sit two by three. A value and its change share a line while they fit and wrap, with the label under them, when the tile is narrow. Nothing scrolls sideways at 320 pixels.

  • Pro

    Ratio Tile Grid Stats

    Goals and progress

    Four goal tiles for a publishing house, each a ratio like 11 of 16, a progress bar and a pace tick that marks where the plan says the goal should stand today, with how many days ahead or behind it is.

  • Pro

    Delta Pill KPI Tiles Stats

    KPI bands and tiles

    Four raised KPI tiles for a checkout analytics tool, each with its change as a pill: filled for a rise, outlined for a fall and muted for none, with an arrow or a dash and a sign.

  • Pro

    Minimal KPI Bar Stats

    KPI bands and tiles

    Four figures for a bookkeeping tool in cells that share their hairlines from rail to rail, each only a label and a value, under a one-line header that names the period.

  • Pro

    Seven rows, one per weekday, each a strip of 24 hourly squares scaled to that day's own peak, with its total and its peak hour, in cells whose lines run past their corners.

  • Pro

    Quota Tile Grid Stats

    Goals and progress

    Six plan-quota tiles (seats, API calls, storage, projects, bandwidth, builds) with used against limit, a bar, what is left and a reset hint in days; a tile at 90% or more gets a solid bar and an Upgrade link badge.

  • Pro

    A metrics console in a card in a card that follows your theme: six metric tiles with a value, a signed change and a sparkline are the tabs of one tablist, and choosing one opens a larger chart of its series in a strip below.