shadcn.io is not affiliated with official shadcn/ui
Live Metrics Stats Block for React
A requests-per-second figure beside three smaller API-edge readings that advance together, live, every five seconds, or paused.
Installation
Overview
Live metrics for React with Base UI. Tickwell, an API-edge product, puts a large requests-per-second figure at the start and three smaller readings past a hairline: p95 latency, errors this sample and open connections. A SegmentGroup picks the pace, Live, Every 5 s or Paused, and one tick moves all four SlidingNumber figures. The page plays a fixed script of nine samples once the block is on screen, holds on the last, and stays on the first when motion is reduced. Choosing another pace restarts the wait. The block is SegmentGroup, SlidingNumber and Guides. For an API, platform or infrastructure page.
FAQ
How do I change the numbers?
Edit RPS, P95, ERRORS and CONNECTIONS at the top of the file. Each is one reading per sample, and the four lists are the same length. The headline's slowest sample is the maximum of the p95 list, so the sentence and the rail can't disagree. The first item of each list is what the server renders.
What do the three paces do?
Live advances every two seconds. Every 5 s advances every five seconds. Paused waits. Switching pace clears the current wait and starts the new one, so a change is felt at once. After the ninth sample the reading holds no matter which pace is selected, and picking a pace again does not add samples. There is no socket in the demo.
Do all four figures move together?
Yes. One step index is read by the hero and by the three tiles. You never see a new error count beside an old request rate. The hero is the requests-per-second figure; the headline stays on the slowest p95 in the script, so it does not change under the reader on every tick.
What does the line under the control announce?
Only the pace: every two seconds, every five seconds, paused, held on the last sample, or staying on the first because motion is reduced. The sample count sits in the same sentence but outside that live region, so a tick is not announced. The figures themselves are not live regions. Someone who wants the new number can read the figure.
What happens with reduced motion?
The four figures stay on the first sample and the line says so. The pace control still switches, but the script does not play. With motion allowed, the digits roll to the next sample. Nothing loops, and the block does not ping.
How is it laid out on a phone?
The hero column comes first: the headline, the large figure, the pace control and the sample line. The three readings follow, under a rule, in the same order. From lg they sit beside the hero, and the divider runs up to the block's top rule. Only the start column fades in, because the rail can fall below the fold on a phone.
</FaqList>
Related
- Pro
Compact KPI Tile Grid Stats
KPI bands and tilesSix 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.
- Pro
Split Subvalues Hero Metric Stats
Hero metricA parcel carrier's weekly total in display type at the start of a split, with its three service levels as rows at the end, each with its count and a share bar, so the shares add up to exactly 100%.
- Pro
Vertical KPI Rail Stats
KPI bands and tilesA split for a shipment tracker: the headline and the week at the start, and past a hairline divider four figures stacked in a narrow rail, each with its change on the week before.
- Pro
Connected KPI Bar Stats
KPI bands and tilesFour headline figures for a subscription analytics tool in cells that share their hairlines from rail to rail, each with its change on the month before and a tiny sparkline of the last twelve months.
- Pro
A 3 by 3 grid of hosting services whose latency and twelve-bar history advance on a timer you can pause, with the one slow service marked.
- Pro
Live Indicator Banner
Live statusA heartbeat callout for a monitoring tool: a framed status dot that sends out one ring on each poll, an all-systems-operational heading, a line with how long ago it checked and the p95 latency, and a status-page link.