Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Period Comparison Table Stats Block for React

A five-row month-on-month report with this period, the period before, and a bar for the size of each change.

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 period comparison table for React with Base UI. Cadenby, a month-on-month reporting product, lines March up against February in a real table of five metrics: net revenue, orders, average order, refunds and new customers. Each row shows this period, the period before, and the change as an arrow and a signed percent, with a bar for the size of that move. The widest move fills its bar. The average order is revenue divided by orders, so it agrees with the two rows above it. The header states the revenue change and repeats it in one Badge. The block has no state: it is Guides, Badge and a table. For a finance, commerce or reporting page.

FAQ

How do I change the months?

Edit NOW, BEFORE and SOURCES at the top of the file. Each source is a label, a value for this period, a value for the period before, and a write function that formats it. The percent, the arrow, the bar, the headline and the pill are all read from those pairs. The month names have no year, so the copy never goes stale.

Why does the average order agree with revenue and orders?

It is not typed in. The row divides net revenue by orders and keeps the result in cents, then writes it as dollars and cents. Change either of those two rows and the average, its percent and its bar move with them. The same formula is used for both months.

What does the bar measure?

The size of the change, ignoring whether it rose or fell. The widest absolute percent fills the bar, and the others are a fraction of it. In this data that widest move is refunds, which is why the sentence under the headline names them. The caption says the same thing, and both are computed from the rows, so a different set of numbers renames the widest move on its own.

Why isn't a fall red and a rise green?

A fall is not always bad: refunds going down is good news, revenue going down is not. The table shows the direction with an arrow and a sign, in the text colour, and leaves the judgement to the reader. The pill in the header uses the same rule, filled when the headline rose and outlined when it fell. That also keeps the block correct in every theme preset.

What happens on a phone?

The February column hides. The change cell adds a short "vs February" so the comparison is still named, and the March figures stay. From md both periods are columns and that hint hides. The header fades in once; the table does not, because on a short screen it can start below the fold.

Does anything move?

Only the header's entrance. The table is static: there is no switch, no tick and no control. The pill is the headline's change, not a control. Values sit in bdi elements, signed changes are kept in order in every language, and the minus is a true minus sign. The bars are decorative, because the percent next to them is the change.

</FaqList>

  • Pro

    A funnel as a real table for a sales team's pipeline: stage, deals, step conversion and value, each number with a thin bar to the scale of its column, and the overall conversion rolling in the header.

  • Pro

    Dumbbell Chart Stats

    Bar and column

    Eight roles as rows of two dots joined by a line, hollow for the last pay review and solid for this one, sorted by how far each moved, with the gap and a trend arrow at the row's end and a takeaway sentence beside.

  • Pro

    Two bars per month, this year solid and last year lighter, with a Chart and Table switch that swaps the drawing for a real table of the same numbers in the same box.

  • Pro

    Slope Chart Stats

    Area and line

    Six clubs on two vertical axes, after the first and the second quarter, with a solid 2 px line for a club that climbed and a dashed 1 px line for one that slipped, labelled at both ends with the change.

  • Pro

    This week's opens against last week's on one scale, with a switch that shows or hides the second line, its total and the difference.

  • Pro

    Two open 270-degree dials side by side for a sprint-tracking tool, each with its percent done, with a round chip on the divider that gives the gap between the two teams in points.