Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Left-Heavy Metric Cards Hero Block for React

A split hero for an API host: copy and two calls to action beside a column, behind a divider, of three metric cells whose lines overshoot their corners and whose figures roll up into view.

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 split hero with three metric cells in a narrower column, for React with Base UI. On a 1.25fr to 1fr grid between solid rails, the wider column holds an announcement link, a medium-weight headline, a subtitle, a ShineButton as the one primary action and an outline Button, both links. The narrower column sits behind a hairline divider with a + mark where it meets the top rule, and holds three cells with their own hairlines, which overshoot the corners: each has a large figure in tabular digits with its unit, a label and a trend line in the theme's success colour. The figures roll up digit by digit with SlidingNumber once they scroll into view, the cells slide in one after another, and visitors who ask for reduced motion see the final numbers at once. Made for infrastructure products, monitoring tools, API platforms and any SaaS where real numbers tell the story better than adjectives.

FAQ

How do I change the metrics?

Edit the METRICS array at the top of the file. Each entry has a value and its decimals (99.99 with 2), a unit ("ms", "%"), a label, a delta that says which way it moved in words ("18% lower") and a trend arrow, TrendingUpIcon or TrendingDownIcon. A large figure takes a suffix such as K with value: 12.4, and spoken says it in full ("thousand") for screen readers.

When do the numbers roll, and can they show at once?

Each figure is a SlidingNumber with trigger="view": it holds zeros in every digit place until the card is a quarter in view, then rolls each digit to the value, so the card never changes width. With reduced motion the digits jump straight to the value. To show the values from the start, as text in the server's HTML, use trigger="mount"; a later change to value still rolls only the digits that changed.

How do I feed the cards from live monitoring data?

Fetch the figures from your metrics endpoint and pass them in place of the static METRICS array. SlidingNumber rolls from the old value to the new one whenever value changes, so refreshing the data on an interval animates only the digits that moved. Write each delta from the same data so the trend line never contradicts the figure above it.

Is the metric cards hero accessible?

Yes. The headline is the page's one h1, and the cells sit in an aside named "Key performance metrics", each a description list: a screen reader reads the label, then the figure with its unit ("12.4 thousand users"), then the trend in words. The rolling digits are hidden from assistive technology while a visually hidden copy carries the real value, so nothing is read mid-roll, and the trend arrows are decorative.

Why are all three trends green, even the one going down?

The colour says whether the change is good, the arrow says which way it went: latency going down is good news, so it gets a down arrow in the theme's text-success-foreground. For a change that is bad news, use text-destructive on that entry. The words in delta carry the meaning on their own, so the colour is never the only signal.

How does the layout change on smaller screens?

Below the lg breakpoint the grid becomes one column: the copy comes first, with both calls to action on the first screen, and the metric cells stack under it at full width, with a rule and + marks between the two. The headline wraps, balanced, at text-4xl, and the calls to action wrap when the row runs out of room. Nothing scrolls sideways down to 320px.

  • Pro

    Metric Tiles Hero

    Stats and live data

    A compact left-aligned hero for an edge network with a live status pill, a Shine Button and an outline button at the end of the row, and four metric tiles below, each a ruled cell with a trend.

  • Pro

    Hero With Stats

    Stats and live data

    A split hero with a headline, a Shine Button and a second action beside a rail of four key figures on shared hairlines, each with its period and a small bar trend.

  • Pro

    Animated Counter Hero

    Stats and live data

    A compact centered hero for an invoicing app with an announcement pill, a Shine Button and a second action, over a hairline band of four figures that count up when they scroll into view.

  • Pro

    Counter Stats Hero

    Stats and live data

    A compact, start-aligned hero for an email API on solid rails: a headline, a Shine Button and an outline button, then four counters in separate cells whose hairlines overshoot their corners.

  • Pro

    A showcase centered hero for an API platform, with a live status pill, a Shine Button and a status panel of full-width bands: five services' uptime over the last 30 days.

  • Pro

    Left-Heavy Trust Compliance Hero

    Logos and social proof

    A reverse split hero for a compliance tool: a trust center panel of six certifications in a hairline frame beside a checklist and two calls to action, with the copy first on a phone.