HeroCard
The mock's wallet .hero (radius 28): available big, the free / held track, balance and held, actions.
import { HeroCard } from '@ergasti/bricks';Examples
Wallet hero
The dark card at the top of the wallet: what can be spent, the balance, what is held, and a warning when the wallet is low.
Code
import { Button, HeroCard, type WalletFigures } from '@ergasti/bricks';
const figures: WalletFigures = { available: '43390.00', balance: '61840.00', held: '18450.00', toppedUp: '287800.00', lastTopup: '250000.00', leftPercent: 17, low: true };
function Wallet() {
return (
<div style={{ maxWidth: 520 }}>
<HeroCard figures={figures} actions={<><Button variant="white">Top up</Button><Button variant="on-dark">Pay by bank transfer</Button></>} />
</div>
);
}Healthy and compact
low: false drops the warning; compact is the home-page size.
Code
import { Button, HeroCard, type WalletFigures } from '@ergasti/bricks';
const figures: WalletFigures = { available: '43390.00', balance: '61840.00', held: '18450.00', toppedUp: '287800.00', lastTopup: '250000.00', leftPercent: 17, low: true };
function Healthy() {
return (
<div style={{ maxWidth: 520 }}>
<HeroCard compact figures={{ ...figures, low: false, leftPercent: 62, available: '155000.00' }} actions={<Button variant="white">Top up</Button>} />
</div>
);
}Without the decoration
The corner blob is drawn by default (deco is true). deco={false} leaves it out, as the brand v3 mock's wallet hero and the gallery's Home and Wallet screens do; keep the default where the hero should carry the brand's shape. Default first, deco={false} second.
Code
import { Button, HeroCard, type WalletFigures } from '@ergasti/bricks';
const figures: WalletFigures = { available: '43390.00', balance: '61840.00', held: '18450.00', toppedUp: '287800.00', lastTopup: '250000.00', leftPercent: 17, low: true };
function NoDeco() {
return (
<div style={{ display: 'grid', gap: 16, maxWidth: 520 }}>
<HeroCard compact figures={{ ...figures, low: false, leftPercent: 62 }} actions={<Button variant="white">Top up</Button>} />
<HeroCard compact figures={{ ...figures, low: false, leftPercent: 62 }} deco={false} actions={<Button variant="white">Top up</Button>} />
</div>
);
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key heroCard, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
available | Available | المتاح |
forCreators | for your creators | لصنّاع المحتوى بتوعك |
low | Low · {p}% left | قليل · فاضل {p}% |
balance | Balance | الرصيد |
held | Held | المحجوز |
topped | Topped up in total | إجمالي الشحن |
Design guidance
How the BRICKS design system uses HeroCard. Written in docs/content/components/HeroCard.md; the props above are read from the code, which wins where the two disagree.
The raspberry wallet hero: the money available for creators in a big figure, a track of free and held money against the last top-up, balance / held / topped-up figures and the wallet's buttons; use it at the top of Home and Payments › Wallet.
It is the mock's wallet .hero (radius 28, --rasp background, white text). Home shows the compact version ("Top up by card", "Where it went"); Payments › Wallet shows the full one with "Topped up in total". Every figure carries its MoneyNote "?" explanation. It takes the server's 2-dp strings; it never computes money.
Anatomy
- Container:
.kit-hero, padding 24,--r-xl,--rasp, overflow hidden. - Deco (optional): a
Decoblob at the bottom inline-end corner, 8% opacity. - Top row:
.kit-hero-top- Label:
MoneyNote figure="wallet_available""Available" · "for your creators" (700). - Low pill: lime
Pill"Low · 17% left" whenfigures.lowandleftPercentis not null.
- Label:
- Big figure:
.kit-hero-big, display 40 / 800; currency as a small 18px prefix in English ("EGP 43,390"), suffix in Arabic. - Track:
.kit-hero-track, 10px,aria-hidden: white bar = available, half-white = held, both as a share oflastTopup. - Figures row:
.kit-hero-row, 13px labels with 16px bold values: Balance, Held, and (not compact) Topped up in total. - Actions:
.kit-hero-act, 8px gap.
Variants
| Prop value | Look | When to use |
|---|---|---|
compact={false} (default) | Shows Topped up in total | Payments › Wallet. |
compact | Drops topped up | Home. |
deco (default true) | Corner blob | Kit default. |
deco={false} | No blob | The brand v3 mock's wallet hero. |
money.big / money.row | Per-slot money display | Change decimals or currency display (defaults: big { showCurrency: true, decimals: 'auto' } "EGP 43,390"; row { decimals: 2 } "EGP 61,840.00"). |
States
| State | Trigger |
|---|---|
| Healthy | low: false: no pill. |
| Low | low: true and leftPercent set: lime "Low · N% left" pill. |
| Before first top-up | lastTopup: null, leftPercent: null: the track is empty. |
| Missing figure | an unparsable available shows "—". |
| Focus-visible | buttons inside use the inverse focus ring. |
Types
WalletFigures: available: string, balance: string, held: string, toppedUp?: string, lastTopup: string | null (the track's 100%), leftPercent: number | null (server share 0–100 still available), low: boolean.
Usage
// Brand › Home
<HeroCard compact deco={false}
figures={{ available: '43390.00', balance: '61840.00', held: '18450.00', lastTopup: '250000.00', leftPercent: 17, low: true }}
actions={<>
<Button variant="white" onClick={topUpByCard}>Top up by card</Button>
<Button variant="on-dark" onClick={() => navigate('/payments/wallet')}>Where it went</Button>
</>}
/>// Brand › Payments › Wallet: hero beside the health card
<PillTabs label="Payments" idPrefix="pay" value={tab} onChange={setTab}>
<PillTabs.Tab value="wallet">Wallet</PillTabs.Tab>
<PillTabs.Tab value="payouts">Payouts</PillTabs.Tab>
</PillTabs>
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 }}>
<HeroCard deco={false} figures={{ ...wallet, toppedUp: '412000.00' }}
actions={<><Button variant="white">Top up</Button><Button variant="on-dark">Pay by bank transfer</Button></>} />
<WalletHealthCard {...health} />
</div>Where it appears
- Brand › Home › wallet hero, compact (BrandHome).
- Brand › Payments › Wallet › wallet hero, full (BrandWallet).
Guidelines
Do
- Pass the server's strings and
leftPercent; never compute the share in the UI. - Use two actions at most: a white primary and an on-dark secondary.
Don't
- Don't use it for anything but the wallet; for other big figures use
TileorKpiCard. - Don't hide the
MoneyNoteexplanations.
RTL and Arabic
- English: "EGP 43,390" (currency prefix). Arabic: amount then "ج.م" in an LTR-isolated run, so digits never reorder.
- Labels: "المتاح · لصنّاع المحتوى بتوعك", "الرصيد", "المحجوز", "إجمالي الشحن"; low pill "قليل · فاضل 17%".
- Big figure uses
--lh-arfor Arabic line height; the blob moves to the left corner.
Tokens
--rasp, --r-xl, --font-family-display, --lh-ar, --focus-ring-inverse; Pill lime tones.
Accessibility
- The track is
aria-hidden; available, balance and held are text. - Each label is a
MoneyNotebutton that explains the figure. - White on
--raspmeets AA for the 13px+ text; buttons use--focus-ring-inverse.
Found in the source
- ARIA attributes set:
aria-hidden.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
WalletHealthCard: the low-balance health beside it on Wallet.MoneyNote,Money: its figure parts.Tile,KpiCard: smaller figure tiles.TopUpAmountPicker: what "Top up" opens.
See also: useBricks · useMoneyDisplay · Deco · Pill · Button · Accordion · Card · KeyValue
Source
src/kit/patterns/HeroCard.tsx (line 47) on GitHub.