HapplyUI

Components

Performance Card

One border around a subject and its numbers. The header holds the media, title, meta row and stat tiles; anything after it, such as a table, carries the header's inset.


Installation

bunx @happlyui/cli@latest add performance-card

Dependencies

npm packages

  • @remixicon/react@^4.6.0

Registry dependencies

These are automatically installed when you add this component.

  • happly-ui-utils

Usage

import * as PerformanceCard from "@/components/ui/performance-card"

<PerformanceCard.Root>
  <PerformanceCard.Header media={<PerformanceCard.Media className="size-36" />}>
    <PerformanceCard.Title>Person name</PerformanceCard.Title>
    <PerformanceCard.Meta>In-person meeting</PerformanceCard.Meta>
    <PerformanceCard.Stats>
      <PerformanceCard.Stat value={214} label="Bookings" />
      <PerformanceCard.Metric value={240} label="Tickets sold" delta={-5.4} comparison="vs last week" />
    </PerformanceCard.Stats>
  </PerformanceCard.Header>
</PerformanceCard.Root>

Examples

Default

A wide thumbnail, a truncating title, a meta row of icons, text and badges, and tiles of a figure and its label. The media takes a width only, so it fills the header's height and its bottom edge lines up with the tiles.

Session title

12 Feb 202610:00 (GMT+1)
Embedded tool
Public
32,458
Total views
18m 42s
Avg. watch time
24:10
Drop-off peak
128
Comments
<PerformanceCard.Header
  media={<PerformanceCard.Media className="w-[270px]" />}
  action={<Button.Root>Details</Button.Root>}
>
  <PerformanceCard.Title className="text-title-h6 truncate">Session title</PerformanceCard.Title>
</PerformanceCard.Header>

With sub-labels

Sub-labels sit on the title's baseline, each behind a rule. The media falls back to its placeholder when there is no image.

Person name

Rolename@example.com
In-person meeting
Group A
Group B
214
Bookings
186
Attended
87%
Attendance rate
42m
Avg. duration
12
Cancellations
<PerformanceCard.Title sublabels={['Role', 'name@example.com']}>
  Person name
</PerformanceCard.Title>

With a change

Use Metric instead of Stat when the figure carries its change against another period. The arrow gives the direction, green up and red down, and the percentage is unsigned.

Event name

12 Feb 2026Somewhere
Public
240
Total tickets sold
−5.4%vs last week
$112,241.00
Revenue generated
+7.2%vs last week
<PerformanceCard.Metric
  value={240}
  label="Total tickets sold"
  delta={-5.4}
  comparison="vs last week"
/>

With content below

Root has no padding, so content under the header sets its own. Match the header's 24px inset and a table's header band sits inside the card, as the design draws it.

Session title

12 Feb 2026
32,458
Total views
128
Comments
NameRegionViews
Person oneMontreal, Canada1,240
Person twoVancouver, Canada980
Person threeToronto, Canada612
<PerformanceCard.Root>
  <PerformanceCard.Header>…</PerformanceCard.Header>
  <div className="px-6 pb-6">
    <Table.Root>…</Table.Root>
  </div>
</PerformanceCard.Root>

API Reference

PerformanceCard.Root

The card's single border. No padding of its own, so each part sets its own: the header's 24px inset is what content below it should match.

PropTypeDefaultDescription

PerformanceCard.Header

The padded top of the card. 24px padding, 16px between the media and the rest.

PropTypeDefaultDescription
mediaReactNode-A Media, to the left of the children
actionReactNode-Sits top right, level with the title. Usually a Button

PerformanceCard.Media

The thumbnail or avatar. Give it a width and it fills the header's height, so its bottom edge lines up with the stat tiles. A square avatar can take size- instead.

PropTypeDefaultDescription
srcstring-The image
altstring''The image's description
placeholderReactNode-Shown instead of the image when there is no src

PerformanceCard.Title

The card's name. Size it with className: text-title-h6 for a wide card, the default text-label-lg for a compact one.

PropTypeDefaultDescription
sublabelsReactNode[][]Sit on the title's baseline, each behind a rule

PerformanceCard.Rule

The 1px rule between a title's sub-labels, or between groups in the meta row.

PropTypeDefaultDescription

PerformanceCard.Meta

The wrapping row of icons, text and badges under the title, 8px below it.

PropTypeDefaultDescription

PerformanceCard.Stats

The row of tiles, 12px under the meta row. Tiles share the width equally.

PropTypeDefaultDescription

PerformanceCard.Stat

One tile: the figure and its label.

PropTypeDefaultDescription
valuenumber | string-A number is formatted with toLocaleString; a string is shown as given
labelstring-What the figure counts

PerformanceCard.Metric

A tile that also carries its change against another period. Takes Stat's props too.

PropTypeDefaultDescription
deltanumber-Change against the comparison period, in percent. The arrow carries the direction, so the percentage is shown unsigned
comparisonstring-What the delta compares against, such as "vs last week"

Previous
Metric List