BundleGrid
The bundles as a responsive card grid (one column on a phone), with loading, error + Try again and empty.
import { BundleGrid } from '@ergasti/bricks';Examples
UGC bundles
A bundle's videos, price and price per video, a "Best value" mark, and a Buy button; a closed bundle shows why.
Code
import { BundleCard, type UgcBundle } from '@ergasti/bricks';
const bundles: UgcBundle[] = [
{ id: 1, name: 'Starter', videos: 5, price: '2500.00', perVideo: '500.00', includes: ['5 creator videos', '1 revision each'] },
{ id: 2, name: 'Growth', videos: 15, price: '6000.00', perVideo: '400.00', bestValue: true, includes: ['15 creator videos', '2 revisions each', 'Raw files'] },
{ id: 3, name: 'Scale', videos: 40, price: '14000.00', perVideo: '350.00', closedReason: 'Not available for your plan yet' },
];
function Cards() {
return (
<div style={{ display: 'grid', gap: 16, gridTemplateColumns: 'repeat(auto-fit, minmax(240px, 1fr))' }}>
{bundles.map((b) => <BundleCard key={b.id} bundle={b} onBuy={() => {}} />)}
</div>
);
}The grid with its states
The grid lays the cards out and draws loading, error and empty; buyingId shows which card is being bought.
Code
import { BundleGrid, type UgcBundle } from '@ergasti/bricks';
const bundles: UgcBundle[] = [
{ id: 1, name: 'Starter', videos: 5, price: '2500.00', perVideo: '500.00', includes: ['5 creator videos', '1 revision each'] },
{ id: 2, name: 'Growth', videos: 15, price: '6000.00', perVideo: '400.00', bestValue: true, includes: ['15 creator videos', '2 revisions each', 'Raw files'] },
{ id: 3, name: 'Scale', videos: 40, price: '14000.00', perVideo: '350.00', closedReason: 'Not available for your plan yet' },
];
function Grid() {
return (
<div style={{ display: 'grid', gap: 16 }}>
<BundleGrid bundles={bundles} onBuy={() => {}} buyingId={2} />
<BundleGrid bundles={[]} status="error" error="We could not load the bundles." onRetry={() => {}} />
</div>
);
}Buying, closed, and the price note
buying marks the card whose purchase is opening; unavailable closes a card with a reason (the grid passes one to all); figure puts a money "?" on the price from your notes dictionary.
Code
import { BundleCard, MoneyNotesProvider, useLanguage, type UgcBundle } from '@ergasti/bricks';
import { moneyNotes } from './sample-data';
const bundles: UgcBundle[] = [
{ id: 1, name: 'Starter', videos: 5, price: '2500.00', perVideo: '500.00', includes: ['5 creator videos', '1 revision each'] },
{ id: 2, name: 'Growth', videos: 15, price: '6000.00', perVideo: '400.00', bestValue: true, includes: ['15 creator videos', '2 revisions each', 'Raw files'] },
{ id: 3, name: 'Scale', videos: 40, price: '14000.00', perVideo: '350.00', closedReason: 'Not available for your plan yet' },
];
function CardStates() {
const language = useLanguage();
return (
<MoneyNotesProvider notes={moneyNotes(language)}>
<div style={{ display: 'grid', gap: 16, gridTemplateColumns: 'repeat(auto-fit, minmax(240px, 1fr))' }}>
<BundleCard bundle={bundles[0]} onBuy={() => {}} buying figure="program_cost" />
<BundleCard bundle={bundles[1]} onBuy={() => {}} unavailable="UGC bundles open when your wallet goes live" />
</div>
</MoneyNotesProvider>
);
}Grid loading and closed
status="loading" draws placeholder cards; unavailable closes every card with one reason. figure and cardLabels pass through to each card.
Code
import { BundleGrid, MoneyNotesProvider, useLanguage, type UgcBundle } from '@ergasti/bricks';
import { moneyNotes } from './sample-data';
const bundles: UgcBundle[] = [
{ id: 1, name: 'Starter', videos: 5, price: '2500.00', perVideo: '500.00', includes: ['5 creator videos', '1 revision each'] },
{ id: 2, name: 'Growth', videos: 15, price: '6000.00', perVideo: '400.00', bestValue: true, includes: ['15 creator videos', '2 revisions each', 'Raw files'] },
{ id: 3, name: 'Scale', videos: 40, price: '14000.00', perVideo: '350.00', closedReason: 'Not available for your plan yet' },
];
function GridStates() {
const language = useLanguage();
return (
<MoneyNotesProvider notes={moneyNotes(language)}>
<div style={{ display: 'grid', gap: 16 }}>
<BundleGrid bundles={[]} status="loading" />
<BundleGrid bundles={bundles.slice(0, 2)} onBuy={() => {}} unavailable="UGC bundles open when your wallet goes live" figure="program_cost" cardLabels={{ buy: 'Get bundle' }} />
<BundleGrid bundles={[]} />
</div>
</MoneyNotesProvider>
);
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key bundleGrid, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
label | UGC bundles | باقات الـUGC |
empty | No UGC bundles on offer right now. | مفيش باقات UGC متاحة دلوقتي. |
Design guidance
How the BRICKS design system uses BundleGrid. Written in docs/content/components/BundleGrid.md; the props above are read from the code, which wins where the two disagree.
The UGC bundles on offer as a responsive grid of BundleCards, with loading, error + Try again and empty states; use it as the body of the bundles page or card.
It lays out cards at least 240px wide (one column on a phone), passes onBuy, the opening purchase (buyingId) and a shared unavailable reason (bundles closed until the wallet goes live) to every card. Bundles are not in the v3 mock; this block was built for the live console.
Anatomy
- List:
ul.kit-blk-bundlesnamed "UGC bundles", gridrepeat(auto-fill, minmax(min(100%, 240px), 1fr)), 16px gap. - Item:
liholding aBundleCard(cards stretch to equal height). - States: shared block states (skeleton rows; error box with "Try again"; "No UGC bundles on offer right now.").
Variants
| Setup | Look | When to use |
|---|---|---|
| Default | Cards with Buy | Bundles on sale. |
unavailable | Every card closed with the reason | Wallet not live yet. |
No onBuy | Cards without buttons | Read-only. |
States
| State | Trigger |
|---|---|
| Ready | status="ready" (default). |
| Buying | buyingId matches a card: that card shows "Buying…". |
| Loading | status="loading". |
| Error | status="error" with error, "Try again" when onRetry. |
| Empty | ready with bundles=[]. |
Usage
const bundles = useResource<UgcBundle[]>(urls.bundles);
const [checkout, setCheckout] = useState<UgcBundle['id'] | null>(null);
const [method, setMethod] = useState<BundlePayMethod>('wallet');
const selected = bundles.data?.find((b) => b.id === checkout) ?? null;
<>
<BundleResultBanner result={params.get('bundle')} onDismiss={clearResult} />
<Card title="UGC bundles" sub="Creator videos for your ads and pages">
<BundleGrid bundles={bundles.data ?? []} status={bundles.status === 'idle' ? 'ready' : bundles.status}
error={bundles.error?.message} onRetry={bundles.reload}
onBuy={setCheckout} buyingId={checkout}
unavailable={wallet.live ? null : 'UGC bundles open when your wallet goes live.'} />
</Card>
<Modal open={checkout !== null} title="Buy a UGC bundle" onClose={() => setCheckout(null)}>
{selected && (
<BundlePurchaseSummary bundle={selected} available={wallet.available} method={method} onMethodChange={setMethod}
onConfirm={(m) => buy.run({ bundleId: selected.id, method: m })} onCancel={() => setCheckout(null)} />
)}
</Modal>
</>Where it appears
- Not in the v3 mocks (blocks inventory: built). Shown in the missing-brand gallery (bundles section, loading / empty / unavailable frames).
Guidelines
Do
- Keep 2–4 bundles; let the server mark the best value.
- Use
unavailableinstead of hiding the grid when bundles are closed.
Don't
- Don't wrap cards in your own grid; the block handles widths.
RTL and Arabic
- Grid flows right to left. Arabic empty: "مفيش باقات UGC متاحة دلوقتي."
Tokens
Grid itself none beyond spacing; cards use BundleCard tokens; states use --rasp-50, --bad, --ink-3.
Accessibility
- A
ulnamed "UGC bundles"; each card is a namedarticle. - Loading is
aria-busywith a hidden "Loading…"; errors arerole="alert".
Found in the source
- ARIA attributes set:
aria-label.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
BundleCard,BundlePurchaseSummary,BundleResultBanner.StatGrid/KpiGrid: grids for figures, not offers.
See also: useLanguage · MoneyNotesProvider
Source
src/blocks/bundles/BundleGrid.tsx (line 44) on GitHub.