shadcn.io is not affiliated with official shadcn/ui
Dual Stat Metric Banner Block for Ark UI
A two-figure metric banner for a store dashboard: two cells split by a hairline, each with a label, a big figure, its change on last week, a thin bar to the weekly goal and that share in words.
Installation
Overview
A two-figure metric banner for React with Ark UI, for a dashboard that wants two numbers side by side and nothing else. Two cells share the column between the page's solid rails, split by a hairline that runs up to the top rule with a + mark where they meet; on a phone the cells stack with a rule between them. Each cell holds a label, a big figure, an arrow with its change on last week, a thin bar filled to the share of the weekly goal, and that share in words. The bars are your theme's foreground; only a falling change carries the destructive colour, and only on its arrow. It's built from Guides and Progress, with your theme's tokens for every colour. For weekly digests, store and sales summaries, A/B result strips and any header that compares two figures at a glance.
FAQ
How do I change the two figures?
Edit METRICS at the top of the file: each entry has a label, the figure as text, the change on last week as a number (a positive one points up, a negative one down), the share of the goal reached and the goal as text. The share is typed, not computed from the figure, because the figure is already formatted ("$38.4k"); keep the two in step when you change one.
Why is only the falling change coloured?
A rise is the normal case and a fall is the exception, so colour is spent on the exception. The arrow for a fall uses the destructive colour; the number itself stays in the foreground colour, which keeps the text readable in every theme and means the change reads the same without colour, through the sign, the arrow's direction and the words "on last week". The bars never take a status colour, because nothing here has crossed a limit.
Is the bar read out to screen readers?
The bar is a picture of the sentence under it, so it is hidden from assistive technology and the words carry the information: "64% of the week's 6,700 goal". Each figure and its change are plain text, with the percentage and amounts in bdi elements so a right-to-left layout keeps the signs and units in order. The + and the real minus sign are part of the text, so the change is read as a number with a sign.