Cards

On this page

Cards are the container for almost everything on a kit page: charts, tables, forms, facts and lists. A card has an optional header (title, description and actions), a body and an optional footer.

A card with a header, facts and a footerA card with a header, facts and a footer

Figure 1: A card with a title, description, header button, facts and footer actions

<article class="ph-card">
  <header class="ph-card-header">
    <div>
      <h2 class="ph-card-title">Dock 3</h2>
      <p class="ph-card-description">Loading dock at Wattlebrook</p>
    </div>
    <button type="button" class="ph-btn ph-btn--sm">View log</button>
  </header>
  <dl class="ph-dl">
    <dt>Status</dt><dd><span class="ph-status ph-status--success">Open</span></dd>
    <dt>Pallets waiting</dt><dd>18</dd>
  </dl>
  <footer class="ph-card-footer">
    <button type="button" class="ph-btn ph-btn--ghost">Pause</button>
    <button type="button" class="ph-btn ph-btn--primary">Open dock</button>
  </footer>
</article>
ClassWhat it is
.ph-cardThe card: surface colour, a light border, 8px corners, 24px padding
.ph-card-headerTitle block on the left, actions on the right
.ph-card-titleThe card's title (an h2, 16px bold)
.ph-card-descriptionOne line under the title: the unit, period or scope
.ph-card-footerActions under a divider

Compact and flush cards

Compact and flush cardsCompact and flush cards

Figure 2: A compact card and a flush card holding a table

ClassPaddingUse for
.ph-card--compact16pxSmall tiles and dense layouts
.ph-card--flushNoneTables, data grids and maps that run to the card's edges. The header gets its own padding and a divider.
<section class="ph-card ph-card--flush">
  <header class="ph-card-header"><h2 class="ph-card-title">Busiest campuses</h2></header>
  <div class="ph-table-wrap">
    <table class="ph-table">...</table>
  </div>
</section>

Clickable cards

A card that is a link or button (<a class="ph-card"> or <button class="ph-card">) gets a hover border. Use it for a card that opens something, and keep the whole card one link: don't put other buttons inside it. For a grid of things to open, use action tiles.

Action tiles

An action tile is a small tile that leads somewhere: a signal that needs attention, a shortcut, a template, a category. The whole tile is the link or button. On hover and focus it takes a blue border and tint, and the arrow after its action label moves right. Without a link or button it's a static tile. Tiles in the same row stretch to the same height, so their action labels line up.

Action tilesAction tiles

Figure 3: A link tile, a button tile and a static tile, each with an icon, a description and a count

<div class="ph-grid-3">
  <a class="ph-tile" href="/late">
    <span class="ph-tile-header">
      <span class="ph-tile-icon ph-tile-icon--danger" aria-hidden="true"><svg class="ph-icon">...</svg></span>
      <span class="ph-tile-body">
        <span class="ph-tile-title">Late deliveries</span>
        <span class="ph-tile-description">Deliveries running behind schedule today.</span>
      </span>
      <span class="ph-tile-value">12</span>
    </span>
    <span class="ph-tile-action">Review late deliveries <svg class="ph-icon ph-icon--sm">...</svg></span>
  </a>
</div>
ClassWhat it is
.ph-tileThe tile, on an <a>, a <button> or a <div> (static)
.ph-tile-headerIcon, title block and value in a row
.ph-tile-iconA 32px tinted square for an icon: blue, or --success, --warning, --danger, --neutral
.ph-tile-bodyThe title and description
.ph-tile-title / .ph-tile-description14px semibold title and a 12px line under it
.ph-tile-valueA figure at the top right, such as a count
.ph-tile-actionThe blue action label along the bottom; end it with an arrow icon

Use spans inside a tile, as above: a <button> can only hold inline content.

Stat tiles

.ph-stat is a tile for one headline number. See KPI tiles, which can also draw the change and a trend line for you.

React

import { Card, StyledButton } from 'ph-app-kit-react';

<Card title="Deliveries per day" description="Last 14 days" action={<StyledButton size="small">View all</StyledButton>}>
  ...
</Card>

ActionTile renders an action tile: a link with href, a button with onClick, or a static tile with neither. tone colours the icon square (info by default, or success, warning, danger, neutral), and anything you pass as children goes under the title.

import { ActionTile, Card } from 'ph-app-kit-react';
import { ShieldAlert } from 'lucide-react';

<Card title="Needs attention" description="Each tile filters the deliveries below.">
  <div className="grid gap-3 sm:grid-cols-2 xl:grid-cols-3">
    <ActionTile
      icon={<ShieldAlert size={18} />}
      tone="danger"
      title="Late"
      description="Running behind schedule."
      value={12}
      actionLabel="Show late deliveries"
      onClick={() => setStatus('Late')}
    />
  </div>
</Card>

Guidelines

  • Title every card that holds data, and say the unit and period in the description ("Last 14 days, all warehouses").
  • Card titles are h2; the page has the only h1.
  • One job per card. Split a card that needs two titles.
  • Put cards in grids so they line up and fill wide screens.