# Metric Group

Several Metric Cards in one frame, divided by hairlines — the KPI row at the top of a dashboard.

- Category: KPI / Metric Card
- Page: https://wunderui.com/components/metric-group
- Tier: Core and Pro

## Install

Metric Group ships with WunderUI Core and Pro in the @wunderui/react package.

## Import

```tsx
import { MetricGroup } from "@wunderui/react"
```

## Minimal usage

Then use it:

```tsx
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

- [Metric Card](https://wunderui.com/components/metric-card) for a single card, or cards that should keep their own frame
- [KPI Group](https://wunderui.com/components/kpi-group) for plain figures with a delta, without a chart, a chip or a menu
- [Table](https://wunderui.com/components/table) for many figures to compare in rows and columns

## Behavior

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

- `MetricGroup`: 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.
- `Card`: 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.
- `Divider`: 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.
- 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.
- 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.
- 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 use a good fall as a trend in a card. The chip colours by direction only, so falling churn turns red.
- 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 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

### MetricGroup

| Prop | Type | Default | Description |
|---|---|---|---|
| children* | ReactNode |  | The cards, usually MetricCard. Every direct child loses its border, radius and shadow and gets the card surface. |
| className | string |  | Extra classes for the grid, for example a width or a different gap. The grid is full width by default. |
| columns | 2 \| 3 \| 4 | 4 | The widest layout. One column below `sm`; 2 and 3 apply from `sm`, 4 shows two columns from `sm` and four from `lg`. Defaults to 4. |

## Examples

### Columns: two, three or four

### Cards: values, sparklines, mixed content

### Rows: one, two or three

## In context

### Revenue overview: the period named once

The group has no header, so put the title and period in your own markup above it. The cards then carry only their change.

### Period: the same group for the period you choose

Every figure and change follows the period. A fall in active users is bad and turns red.

### States: ready, loading, empty, error, stale

The group has no states of its own. Use a skeleton while loading, an Empty State or Alert when empty or failed, and a warning that says how old stale figures are.

## For AI agents

`get_component("metric-group")`

Hand your agent this page as Markdown or the WunderUI MCP server, not a screenshot.
