Metric Group
Several Metric Cards in one bordered frame, divided by thin lines: the row of figures at the top of a dashboard.
Playground
Installation
Metric Group comes with WunderUI Core and Pro, in the package from your plan. See the plans.
Then import what you need:
import { MetricGroup } from "@wunderui/react"Then use it:
import { MetricCard, MetricGroup } from "@wunderui/react"
export function Overview() {
return (
<MetricGroup columns={4}>
<MetricCard label="Revenue" value="$85,250" trend={{ value: "+12.3%" }} caption="vs last month" />
<MetricCard label="New customers" value="1,204" trend={{ value: "+8.1%" }} caption="vs last month" />
<MetricCard label="Active users" value="1,842" trend={{ value: "-3.1%", direction: "down" }} caption="vs last month" />
<MetricCard label="Average order" value="$70.80" trend={{ value: "0.0%", direction: "neutral" }} caption="vs last month" />
</MetricGroup>
)
}Expected result: You see one framed row of four cards divided by thin lines, each with its figure and its change.
When to use
Use Metric Group for
- The row of figures at the top of a dashboard or a report
- Metric Cards that share one period and one question
- Cards of different content, such as a sparkline, a goal and a status, in one frame
Use something else for
- Metric Card for a single card, or cards that should keep their own frame
- KPI Group for plain figures with a delta, without a chart, a chip or a menu
- Table for many figures to compare in rows and columns
Columns
The widest layout is 2, 3 or 4 columns, and narrow screens get one. The layout follows the window, not the box the group sits in.
Cards
Any Metric Card works in the group, and they can differ: sparkline, goal, breakdown. The group removes their border, radius and shadow, and a row is as tall as its tallest card, so fill every row.
Rows
The group wraps to a new row after the column count, so give it a multiple of that: three columns with 3, 6 or 9 cards make full rows. Never leave a row half full.
Behavior and motion
What the group renders and how it lays out its cards.
- Static
- MetricGroup is not interactive: no focus, hover or handlers. The controls in your cards keep their own keyboard behaviour.
- Columns
- Columns is 2, 3 or 4 (default 4), and below the sm breakpoint there is one column. With 4 you get two from sm and four from lg, following the window and not the box around the group.
- Equal heights
- The cards of a row stretch to the tallest one. Their content stays at the top, so a shorter card has empty space under it.
- Rows that are not full
- A row with fewer cards than columns leaves slots empty, and they show the border colour. Fill the rows.
- Frame
- The group clips its cards to its 12 px radius and draws the border. Direct children lose their own border, radius and shadow, even a skeleton.
- No header or context
- The Figma group has a shared title, period and context line. The React group does not yet, so put them in your own markup above and below, as the Examples tab does.
- Props
- Only children, columns and className are read. Other props such as role or aria-label are not forwarded to the grid.
- Reading
- The group adds no role or label, so a screen reader reads the cards in order. Name the group with a heading before it.
- States
- There is no loading, empty or error state. The Examples tab shows a skeleton group, an Empty State, an Alert and a warning above stale figures.
- Motion
- None of its own. The cards keep their motion, such as sparkline bars and the menu panel.
- Reduced motion
- The group does not move, so reduced motion changes nothing in it. The cards follow their own rules.
Anatomy
The figure shows a group of two cards. The group draws the frame and hairlines; the cards draw their content.
- data-slot="metric-group"
A grid with a 1 px border, 12 px radius and the border colour as background. The 1 px gaps between cards show that colour and draw the hairlines, and the columns prop sets the widest layout.
Any child, usually a MetricCard. The group removes the card border, radius and shadow and paints the card surface, so a card never sits in a card, and cards in a row share the same height.
The 1 px hairline between two cards. It is the gap of the grid, vertical between cards side by side and horizontal when they stack.
Best practices
- Do
Fill every row. Use 4 cards for 4 columns and 6 for 2 or 3, so no slot is left empty.
- Do
Name the period and context once, in a heading above the group and a note below it, and leave the caption off the cards. The group has no header of its own.
- Do
Give the cards of one group the same structure. Mixed content works since rows stretch to equal height, but identical cards are easiest to compare.
- Do
Use four columns for a full-width dashboard row and fewer inside a narrower page. Breakpoints follow the window, not the box the group sits in.
- Don’t
Don't leave a row half full. Empty slots show the border colour, so the last row reads as a grey block with a hole.
- Don’t
Don't use a good fall as a trend in a card. The chip colours by direction only, so falling churn turns red.
- Don’t
Don't put cards with their own frame next to the group and call it one row. Cards in the group have no border of their own.
- Don’t
Don't expect role, aria-label or other attributes on the grid. It takes only children, columns and className, so wrap it in your own element.
API reference
One table for MetricGroup. It is a plain component, so this table lists every prop.
A grid with a 1 px border, 12 px radius and the border colour as background. The 1 px gaps between cards show that colour and draw the hairlines, and the columns prop sets the widest layout.
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("metric-group")The full library index for assistants is at /llms.txt.