Tile
The mock's .tile. When clickable, a real <button> covers the tile and is named by its label and value (aria-labelledby); the label's own "?" term sits above it, so no button is nested in another.
import { Tile } from '@ergasti/bricks';Examples
Stat tiles
A label, a big value, a change and a small chart. A tile with onSelect is a button; selected marks it as the active one.
Code
import { Delta, MiniBars, Spark, Tile } from '@ergasti/bricks';
import { mock } from './sample-data';
function Stats() {
return (
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(220px, 1fr))', gap: 16 }}>
<Tile tone="lime" label="Sales" value="EGP 312K" delta={<Delta value={9.6} />} chart={<Spark data={mock.SERIES.sales} tone="lime" label="Sales" />} onSelect={() => {}} />
<Tile tone="rasp" label="Orders" value="1,284" delta={<Delta value={7.9} />} chart={<MiniBars data={mock.SERIES.orders.slice(-12)} label="Orders" />} onSelect={() => {}} selected />
<Tile tone="butter" label="Commission" value="EGP 46.9K" chart={<Spark data={mock.SERIES.commission} tone="butter" label="Commission" />} />
<Tile tone="sky" label="Sales per EGP 1 paid" value="EGP 6.70" delta={<Delta value={0.4} unit="abs" />} chart={<Spark data={mock.SERIES.roi} tone="sky" label="ROI" />} />
</div>
);
}Metric size
size="metric" is the compact KPI tile of the dashboard screens: 132px tall, the value (26px) under the label and the change at the bottom. Use it for a row of four or more figures; the default is for tiles with a chart.
Code
import { Delta, Tile } from '@ergasti/bricks';
function Metric() {
return (
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))', gap: 16 }}>
<Tile size="metric" tone="lime" label="Sales" value="EGP 312K" delta={<Delta value={9.6} />} />
<Tile size="metric" tone="rasp" label="Orders" value="1,284" delta={<Delta value={7.9} />} onSelect={() => {}} selected />
<Tile size="metric" tone="butter" label="Commission" value="EGP 46.9K" delta={<Delta value={-2.1} />} />
<Tile size="metric" tone="sky" label="Creators" value="86" delta={<Delta value={0} />} />
</div>
);
}Decoration
deco adds the mock's soft shape behind the text, in the tile's own ink: 'blob' or 'star'. It is decorative only (hidden from screen readers).
Code
import { Delta, Tile } from '@ergasti/bricks';
function Deco() {
return (
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(220px, 1fr))', gap: 16 }}>
<Tile tone="lime" label="Sales" value="EGP 312K" delta={<Delta value={9.6} />} deco="blob" />
<Tile tone="butter" label="Top creator" value="Nour Hassan" deco="star" />
</div>
);
}KPI size
size="kpi" is the PR Portal's "View as brand" figure box: 120px tall, a bold 14px label and a 26px value at the bottom. Use it for that page's four figures; keep the default tile when the figure has a change and a chart.
Code
import { Money, Tile, count, useLanguage } from '@ergasti/bricks';
function Kpi() {
const language = useLanguage();
return (
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))', gap: 16 }}>
<Tile size="kpi" tone="lime" label="Sales from creators" value={<Money value="412300.00" money={{ decimals: 'auto' }} />} />
<Tile size="kpi" tone="sky" label="Orders" value={count(1284, language)} />
<Tile size="kpi" tone="butter" label="Active creators" value={count(86, language)} />
<Tile size="kpi" tone="rasp" label="Wallet" value={<Money value="43390.00" money={{ decimals: 'auto' }} />} />
</div>
);
}Stat size
size="stat" is the PR Portal's compact count card (113px: a 13px label, a 24px value 6px under it); its sub is the grey 12px line under the value, which says what the count means. Use it for a strip of counts above a list (Gift stock); figures go through count(), the house number format in both languages.
Code
import { Tile, count, useLanguage } from '@ergasti/bricks';
function Stat() {
const language = useLanguage();
return (
<div style={{ display: 'grid', gap: 12, gridTemplateColumns: 'repeat(auto-fit, minmax(180px, 1fr))' }}>
<Tile size="stat" tone="rasp" label="Expected" value={count(4, language)} sub="Claimed, not arrived" />
<Tile size="stat" tone="lime" label="To count" value={count(2, language)} sub="At the warehouse" />
<Tile size="stat" tone="sky" label="With a difference" value={count(1, language)} sub="Fewer good units than claimed" />
<Tile size="stat" tone="lilac" label="Confirmed" value={count(12, language)} sub="Matched the claim" />
</div>
);
}Stat tile with content
A size="stat" tile draws its children after the value, as in 0.4.0 (here a link to the list); sub stays the grey line that says what the count means. Use children for an action or a second line of your own, sub for the explanation.
Code
import { Tile, count, useLanguage } from '@ergasti/bricks';
function StatChildren() {
const language = useLanguage();
return (
<div style={{ display: 'grid', gap: 12, gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))' }}>
<Tile size="stat" tone="butter" label="Problem reports" value={count(1, language)} sub="Brand disputes the count">
<a className="kit-tile-dl" href="#problems">See the report →</a>
</Tile>
<Tile size="stat" tone="sky" label="Running low" value={count(3, language)} sub="Under 20% left" />
</div>
);
}Short tiles
size="short" is the payouts pair: 110px tall, the value at the bottom as the default tile, and a line under it as children ("See who was paid →"). Set the CSS custom property --tile-min-h on a wrapper to raise the minimum: the third tile is the brand mock's 120px Raise-limit plan.
Code
import { Money, Tile } from '@ergasti/bricks';
import type { CSSProperties } from 'react';
function Short() {
return (
<div style={{ display: 'grid', gap: 12, gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))' }}>
<Tile size="short" tone="butter" label="To be paid this month" value={<Money value="31200.00" />} />
<Tile size="short" tone="lime" label="Paid so far this month" value={<Money value="96420.00" />} onSelect={() => {}}><span className="kit-tile-dl">See who was paid →</span></Tile>
<div style={{ '--tile-min-h': '120px' } as CSSProperties}>
<Tile size="short" tone="sky" label="Growth plan · a month" value={<Money value="4500.00" />}><span className="kit-tile-dl">Up to 600 creators</span></Tile>
</div>
</div>
);
}Smaller values
valueSize="sm" (18px) keeps a long goal on one line in a row of stat tiles; "md" is 19px (two stats in a drawer).
Code
import { Tile } from '@ergasti/bricks';
function ValueSize() {
return (
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))', gap: 16 }}>
<Tile size="stat" tone="rasp" label="Joined" value="64" valueSize="sm" />
<Tile size="stat" tone="lime" label="Goal" value="Top 10 by delivered sales" valueSize="sm" />
<Tile size="stat" tone="sky" label="All-time sales" value="EGP 27,000" valueSize="md" />
</div>
);
}Props
Prop
Type
Design guidance
How the BRICKS design system uses Tile. Written in docs/content/components/Tile.md; the props above are read from the code, which wins where the two disagree.
A tinted figure tile: a label (often a money or word term), one big value, an optional delta line, sparkline and corner shape; use it for the headline metrics of Home and Analytics and for small stat boxes elsewhere.
It is the mock's .tile. Brand › Home and Analytics show four size="metric" tiles (lime Sales, rasp Orders, butter Commission, sky "Sales per EGP 1 paid") with a blob or star corner and "▲ 9.6% vs previous 30 days" and no sparkline; on Analytics they are selectable and drive the trend chart. Other sizes cover the payouts tiles, the PR Portal's colour stat cards and View-as-brand boxes. A clickable tile lays one real button over itself, so its label can hold a MoneyNote / Term without nested buttons.
Anatomy
- Tile:
.kit-tile.kit-tile--<tone>, grid (text column + 46% chart column), padding 20,--r-lg, min height 150. - Deco (optional):
blob/starcorner shape. - Hit button (with
onSelect):.kit-tile-hit, covers the tile, named by label, value and sub;aria-pressed=selected. - Label:
.kit-tile-l, 14px / 600. - Chart (optional):
.kit-tile-chart, bottom inline-end, 46% × 46px (Spark,MiniBars). - Value:
.kit-tile-v, display 28 / 800,dir="ltr", pushed to the bottom. - Delta line:
.kit-tile-dl, 12px / 700 (aDeltatakes the tile's ink). - Sub:
.kit-tile-sub, 12px--ink-3. - Children: extra lines after (e.g. "See who was paid →").
Variants
| Prop value | Look | When to use |
|---|---|---|
tone="lime" | "rasp" | "butter" | "sky" | "lilac" | Soft tint with its ink | Metrics; vary across a row (lime, rasp, butter, sky on Home). |
tone="plain" | White, 1px line, no min height | A neutral read-out ("400 seats"). |
size="default" | 150px, 28px value at the bottom | Tiles with a sparkline. |
size="metric" | 132px, 26px value 14px under the label, delta at the bottom | Brand Home / Analytics KPI tiles. |
size="short" | 110px (raise with --tile-min-h) | Payouts "To be paid" / "Paid so far" tiles; Raise-limit plans (120px). |
size="stat" | No min height, padding 18 20, 13px label, 24px value, then sub | PR Portal colour stat cards (Gift stock: Expected / To count / Problems / Confirmed). |
size="kpi" | 120px, 700 label, 26px value | PR Portal View-as-brand boxes. |
deco="blob" | "star" | Corner shape | Where the mock draws one (Home / Analytics metric tiles). |
chart | Sparkline / mini bars | Default-size trend tiles. |
States
| State | Trigger |
|---|---|
| Static | no onSelect. |
| Clickable | onSelect: press nudges 1px. |
| Selected | selected={true}: 2px ink outline, aria-pressed="true" (Analytics' active series). |
| Navigating | onSelect with selected undefined: no aria-pressed (Home). |
| Focus-visible | inset focus ring on the hit button. |
| Gap in series | a null in the Spark data breaks the line. |
Usage
// Brand › Home / Analytics: the four metric tiles (as src/gallery/screens/HomeScreen.tsx)
const vs = 'vs previous 30 days';
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, minmax(0, 1fr))', gap: 14 }}>
<Tile size="metric" tone="lime" deco="blob" label={<MoneyNote figure="sales">Sales</MoneyNote>}
value={<Money value="312400.00" compact />} delta={<Delta value={9.6} context={vs} />}
selected={series === 'sales'} onSelect={() => setSeries('sales')} />
<Tile size="metric" tone="rasp" deco="star" label={<Term tip="Orders placed with a creator coupon, last 30 days">Orders</Term>}
value="1,284" delta={<Delta value={7.9} context={vs} />} selected={series === 'orders'} onSelect={() => setSeries('orders')} />
<Tile size="metric" tone="butter" deco="blob" label={<MoneyNote figure="program_cost">Commission</MoneyNote>}
value={<Money value="46900.00" compact />} delta={<Delta value={9.7} context={vs} />} onSelect={() => setSeries('commission')} />
<Tile size="metric" tone="sky" deco="star" label={<MoneyNote figure="sales_per_commission">Sales per EGP 1 paid</MoneyNote>}
value={<Money value="6.70" />} delta={<Delta value={0.4} unit="abs" context={vs} />} onSelect={() => setSeries('roi')} />
</div>
<Card title="Sales over time"><AreaTrend data={trend[series]} label="Sales, last 30 days" /></Card>// Payments › Payouts: the two short tiles
<Tile size="short" tone="butter" label="To be paid this month" value={<Money value="38250.00" />} />
<Tile size="short" tone="lime" label="Paid so far this month" value={<Money value="96420.00" />}>
<span className="kit-tile-dl">See who was paid →</span>
</Tile>// PR Portal › Gift stock colour stat
<Tile size="stat" tone="rasp" label="Expected" value="3" sub="95 units claimed, not arrived" />Where it appears
- In the v3 mocks: Brand › Home › four metric tiles beside the wallet hero (BrandHome); Brand › Analytics › four selectable metric tiles over the trend chart (BrandAnalytics); Brand › Payments › Payouts › "To be paid" / "Paid so far" tiles (BrandWallet); Raise your creator limit modal plans; PR Portal › Gift stock stat cards (
stat: Expected, …), View-as-brand boxes (kpiinKpiGrid columns={3}) (PrGifts, PrBrandDetail). - Library: the PR creator drawer and challenge screens compose it too.
Guidelines
Do
- Use
size="metric"with a delta and a corner shape for the Home / Analytics row; leave the sparkline out there, as the mock does. - Keep one tone per tile in a row and the same
sizeacross the row. - State the comparison in the delta's
context.
Don't
- Don't put a button or link in
value,deltaorsub. - Don't use
selectedon Home tiles that only navigate. - Don't use a tile for a filter over a list; use
KpiCard.
RTL and Arabic
- Grid mirrors: chart and deco move to the left; label and value align to the inline start.
- Arabic delta: "مقارنة بالـ 30 يوم اللي فاتوا"; values stay LTR through
Money. --lh-arraises thekpivalue's line height for Arabic.
Tokens
--lime-50, --olive, --rasp-50, --rasp-ink, --butter, --butter-ink, --sky, --sky-ink, --lilac, --lilac-ink, --card, --line, --ink, --ink-3, --r-lg, --font-family-display, --lh-ar, --tile-min-h, --focus-ring-inset.
Accessibility
- Clickable: a single overlay
<button>named by label + value (+ sub), witharia-pressedwhen selectable. Deltareads "up" / "down" as words; the arrow is decorative. Charts carry their own label.- Value is LTR so signs and currency keep their order.
Found in the source
- ARIA attributes set:
aria-pressed,aria-labelledby. - Its tests cover: “adds the size class and keeps label, value and delta”.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
KpiCard+KpiGrid: stat cards with icon chip that filter a list.HeroCard: the wallet's big figure.Delta,Spark,MiniBars,MoneyNote,Term: its parts.
See also: Deco · useLanguage · Money · Accordion · Card · KeyValue
Source
src/kit/patterns/Tile.tsx (line 48) on GitHub.