Skip to Content
BBRICKSv0.7.4
KitPatterns

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.

heroCard
KeyEnglishArabic
availableAvailableالمتاح
forCreatorsfor your creatorsلصنّاع المحتوى بتوعك
lowLow · {p}% leftقليل · فاضل {p}%
balanceBalanceالرصيد
heldHeldالمحجوز
toppedTopped 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

  1. Container: .kit-hero, padding 24, --r-xl, --rasp, overflow hidden.
  2. Deco (optional): a Deco blob at the bottom inline-end corner, 8% opacity.
  3. Top row: .kit-hero-top
    1. Label: MoneyNote figure="wallet_available" "Available" · "for your creators" (700).
    2. Low pill: lime Pill "Low · 17% left" when figures.low and leftPercent is not null.
  4. Big figure: .kit-hero-big, display 40 / 800; currency as a small 18px prefix in English ("EGP 43,390"), suffix in Arabic.
  5. Track: .kit-hero-track, 10px, aria-hidden: white bar = available, half-white = held, both as a share of lastTopup.
  6. Figures row: .kit-hero-row, 13px labels with 16px bold values: Balance, Held, and (not compact) Topped up in total.
  7. Actions: .kit-hero-act, 8px gap.

Variants

Prop valueLookWhen to use
compact={false} (default)Shows Topped up in totalPayments › Wallet.
compactDrops topped upHome.
deco (default true)Corner blobKit default.
deco={false}No blobThe brand v3 mock's wallet hero.
money.big / money.rowPer-slot money displayChange decimals or currency display (defaults: big { showCurrency: true, decimals: 'auto' } "EGP 43,390"; row { decimals: 2 } "EGP 61,840.00").

States

StateTrigger
Healthylow: false: no pill.
Lowlow: true and leftPercent set: lime "Low · N% left" pill.
Before first top-uplastTopup: null, leftPercent: null: the track is empty.
Missing figurean unparsable available shows "—".
Focus-visiblebuttons 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 Tile or KpiCard.
  • Don't hide the MoneyNote explanations.

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-ar for 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 MoneyNote button that explains the figure.
  • White on --rasp meets 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.

See also: useBricks · useMoneyDisplay · Deco · Pill · Button · Accordion · Card · KeyValue

Source

src/kit/patterns/HeroCard.tsx (line 47) on GitHub.

On this page