StatusPill
A status word in its tone, from the BricksProvider's statuses table (the TRNDR console's with no provider). An unknown key shows as itself in the mute tone, reported once.
import { StatusPill } from '@ergasti/bricks';Examples
Statuses
One word per state, with a tone, from the provider's statuses table. This example uses the TRNDR table, so it is pinned to that preset.
Code
import { StatusPill, TRNDR_STATUSES } from '@ergasti/bricks';
function Table() {
return (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
{Object.keys(TRNDR_STATUSES).map((status) => <StatusPill key={status} status={status} />)}
</div>
);
}Props
Prop
Type
Design guidance
How the BRICKS design system uses StatusPill. Written in docs/content/components/StatusPill.md; the props above are read from the code, which wins where the two disagree.
A status word in its tone, looked up by key in the provider's statuses table; use it for every record status the API sends (active, pending, paid, rejected…).
StatusPill takes a status key ("active") and draws the matching Pill with the label in the current language and the tone the table gives. The TRNDR preset ships 22 statuses; a provider's statuses adds or replaces keys. An unknown key is shown as itself in the mute tone and reported once with console.warn, so a new server status is visible rather than silently blank.
Anatomy
- Pill (
span.kit-chip--{tone}): the label fromstatuses[key][language].
Variants
TRNDR preset (TRNDR_STATUSES), by tone:
| Tone | Keys (English label) |
|---|---|
ok green | active Active, live Live, accepted Accepted, approved Approved, paid Paid, delivered Delivered |
warn butter | paused Paused, waiting Waiting for TRNDR, waiting_reply Waiting for reply, pending Pending, with_trndr With TRNDR, on_hold On hold, partial Partly paid |
sky | shipped Shipped, scheduled Scheduled |
mute | ended Ended, removed Removed |
bad | expired Expired, stopped Stopped, declined Declined, rejected Rejected, revoked Revoked |
States
| State | Trigger | Look |
|---|---|---|
| Known | key in statuses | Label in its tone |
| Unknown | key missing | The raw key in mute; one console warning per key |
Usage
interface Coupon { id: number; code: string; status: string }
const columns: DataColumn<Coupon>[] = [
{ key: 'code', label: 'Coupon', render: (c) => <CouponChip code={c.code} /> },
{ key: 'status', label: 'Status', render: (c) => <StatusPill status={c.status} /> },
];Add an app-specific status:
<BricksProvider preset={trndrPreset} statuses={{ under_review: { tone: 'sky', en: 'Under review', ar: 'تحت المراجعة' } }}>
<StatusPill status="under_review" />
</BricksProvider>In a table with its neighbours:
<DataTable label="Invitations" rowKey={(i) => i.id} rows={invites} columns={[
{ key: 'creator', label: 'Creator', primary: true, render: (i) => <CreatorCell id={i.creator.id} name={i.creator.name} identity={i.creator.identity} /> },
{ key: 'sent', label: 'Sent', render: (i) => i.sentOn },
{ key: 'status', label: 'Status', render: (i) => <StatusPill status={i.status} /> },
]} footer={<Pager {...pager} />} />Where it appears
- Brand › Creators › My creators, Join requests ("With TRNDR"), Invitations tables.
- Brand › Coupons table, Payments › Commissions orders, Motivation › challenges and gift orders.
- Screens: Creators, Coupons, Payments › Wallet, Motivation.
Guidelines
Do
- Send keys from the server; keep words in the statuses table.
- Add new keys to the provider rather than passing raw labels.
Don't
- Don't use it for PR Portal statuses that have their own table; use
PrStatusPillthere. - Don't mix StatusPill and hand-made Pills for the same field.
RTL and Arabic
- Arabic labels come from the table (e.g.
active→ "نشط"); Arabic line height via--lh-ar.
Tokens
Pill's tone tokens: --ok-bg, --ok, --butter, --butter-ink, --sky, --sky-ink, --soft, --ink-2, --rasp-50, --bad.
Accessibility
- Not interactive and no role: a plain
spanof text, read inline as the label ("Active", "Waiting for TRNDR"). Do not make it a button; filters areFilterChips. - The words carry the meaning; the tone repeats it. Contrast of each tone pair (text on its tint, Brand theme): ok 4.55:1 (
--okon--ok-bg), warn 6.03:1, bad 5.55:1, mute 7.87:1, sky 7.03:1. All pass AA for 12px bold text. - An unknown key is shown, and read, as the raw key ("under_review") in the mute tone, and logged once with
console.warn: add the key to the provider'sstatusesso people hear a real word. - Arabic labels come from the table, so a screen reader in Arabic hears Arabic.
Found in the source
- No roles, ARIA attributes or key handling are set in this component's own source; it renders native elements and the components it composes.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
Pill: the visual base.PrStatusPill,FraudStatusPill,WalletHealthPill: domain status pills.
See also: useBricks · Avatar · AvatarStack · Button · ButtonLink
Source
src/kit/primitives/StatusPill.tsx (line 16) on GitHub.