Banner
The mock's .banner (radius 16, 12 16, 13px): info (sky), warn (butter), lime, bad (rasp-50). The bad tone is an alert; the others are status.
icon is a kit icon name (info, alert, lock, gift, undo, clock, pause, check, seat, creators…), drawn in the banner's ink like every other kit icon (B23). Any other string (the mock's emoji, still accepted) or a node is drawn as given. The body is isolated in its own script's direction (Isolate, B15).
import { Banner } from '@ergasti/bricks';Examples
Tones
Four tones (info, warn, lime, bad), each with an optional icon and an optional action button.
Code
import { Banner, Button } from '@ergasti/bricks';
function Tones() {
return (
<div style={{ display: 'grid', gap: 10 }}>
<Banner tone="info" icon="ℹ️">The TRNDR team reviews every join request. You’ll see the decision here and in your Activity log.</Banner>
<Banner tone="warn" icon="⚠️" action={<Button size="sm">Top up</Button>}>Your wallet is low. Top up so coupons keep working.</Banner>
<Banner tone="lime" icon="🎁">Gifts are sent by the TRNDR team.</Banner>
<Banner tone="bad" icon="⚠️">Your wallet is below zero: your coupons stop earning until you top up.</Banner>
</div>
);
}Small icon
iconSize="sm" draws the icon at the text's size (13px; a kit icon 14px), as the brand v3 mock's banners do: a one-line banner is 42.8px instead of 47.2. The default stays 16px.
Code
import { Banner } from '@ergasti/bricks';
function SmallIcon() {
return (
<div style={{ display: 'grid', gap: 12 }}>
<Banner tone="info" icon="🔒" iconSize="sm">These rules are managed by the TRNDR team. Every change appears in your Activity log.</Banner>
<Banner tone="lime" icon="gift" iconSize="sm">Gifts are sent by the TRNDR team.</Banner>
</div>
);
}Props
Prop
Type
Design guidance
How the BRICKS design system uses Banner. Written in docs/content/components/Banner.md; the props above are read from the code, which wins where the two disagree.
A full-width tinted message strip with an icon, one or two lines of text and an optional action; use it for page-level context ("Gifts are sent by the TRNDR team") or an alert that stays until the cause is fixed.
It is the mock's .banner (radius 16, padding 12px 16px, 13px text), used at the top of a screen or inside a card. Four tones map to meaning: info (sky), warn (butter), lime (positive / promotional), bad (raspberry, an alert). Brand screens open with one: the seats-left banner on Find creators, the join-requests and groups banners on Creators, the lime coupon banner, the bonuses / gifts banners on Motivation and the "managed by TRNDR" lock banner on Settings.
Anatomy
- Container:
.kit-banner.kit-banner--<tone>, flex row, 12px gap,margin-block-end: 16px(0 inside aCard). - Icon (optional):
.kit-banner-ic,aria-hidden. A kit icon name draws an 18px stroke icon in the banner's ink; any other string (emoji) or node is drawn as given (16px). - Text:
.kit-banner-t, flex 1, wrapped inIsolateso it runs in its own script's direction. - Action (optional):
.kit-banner-act, usually a smallButton.
Variants
| Prop value | Look | When to use |
|---|---|---|
tone="info" | --sky background, --sky-ink text | Neutral explanation of how a screen works. |
tone="warn" | --butter / --butter-ink | Needs attention soon: low wallet, seats nearly full. |
tone="lime" | --lime-50 / --olive | Positive or promotional note: the coupons banner, gifts. |
tone="bad" | --rasp-50 / --rasp-ink (#7E1C3A), role="alert" | Something is broken now: wallet below zero. |
Mock .banner.ink | Not a Banner tone. The PR Portal mock's ink strip is ViewAsBanner (the "View as brand" bar). | Use ViewAsBanner; tone takes only the four values above. |
iconSize="md" (default) | 16px glyph / 18px kit icon, 47.2px one-line height | Default. |
iconSize="sm" | Glyph at the text's 13px, kit icon 14px, 42.8px one line | The v3 brand mock's inline glyph (Settings lock banner). |
Icons
Pass a kit icon name. The v3 mocks draw banner emoji; BRICKS draws them as line icons: 💺 → seat, ℹ️ → info, 🔒 → lock, 🏷️ → coupons, 🏆 → motivation, 👥 → creators, 🎁 → gift, ⚠️ → alert. A plain string that is not an icon name (an emoji) is still drawn as given for backward compatibility, but the brand book allows no decorative emoji: do not pass one.
States
| State | Trigger |
|---|---|
| Text only | no icon, no action. |
| With action | action node at the inline end. |
| Long text | wraps; the icon stays vertically centred. |
| Alert | tone="bad" makes it role="alert"; others are role="status". The banner mounts with its text, so a status banner is not reliably read when it appears; an alert usually is. |
Types
icon: a kit icon name (info, alert, lock, gift, undo, clock, pause, check, seat, creators…), an emoji string, or a node. Empty values draw nothing.
Usage
// Brand › Find creators: seats left
<Banner tone="info" icon="seat"><b>3 seats left.</b> Invite creators to fill them, or ask TRNDR to raise your limit.</Banner><Banner tone="warn" icon="alert" action={<Button size="sm" onClick={openTopUp}>Top up</Button>}>
Your wallet is low. Top up so coupons keep working.
</Banner>// Settings: the lock banner above the section grid
<PageHeader title="Settings" subtitle="Your program's rules and details" />
<Banner tone="info" icon="lock" iconSize="sm">
These rules are managed by the TRNDR team. To change anything, contact your account manager.
</Banner>
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 }}>{sections.map((s) => <SettingsSection key={s.id} {...s} />)}</div>Where it appears
- In the v3 mocks: Brand › Find creators › seats-left banner (BrandFindCreators); Brand › Creators › Join requests and Groups banners (BrandCreators); Brand › Coupons › lime banner (BrandCoupons); Brand › Motivation › Bonuses and Gifts banners (BrandMotivation); Brand › Settings › lock banner "These rules are managed by the TRNDR team…" (BrandSettings); Brand › Payments › Wallet › wallet health card's low-balance banner (
WalletHealthCard); Brand › Motivation › challenge reason / waiting banners (ChallengeCard,ChallengeDetail). - Library only (no mock region):
BundleResultBanner,TopUpResultBanner,MessagesPanel; PR blocks that use it (PrCreatorDrawer, gift warehouse / shipment / claims cards,NextCampaignCard,CustomerAffiliatesSwitch).
Guidelines
Do
- One banner per screen top; put it directly under the page header or tabs.
- Match tone to meaning; reserve
badfor a state that blocks money or creators. - Keep it to one or two sentences; lead with the fact in bold.
Don't
- Don't pass emoji as
icon; use the kit icon names above. - Don't stack several banners; merge them or move detail into the card.
- Don't use
badfor validation errors on a form field; useFormField error. - Don't put more than one action in it.
RTL and Arabic
- Logical layout: icon at the inline start, action at the inline end, mirrored in RTL.
Isolatesets the text's direction from its script, so an Arabic message with a Latin brand name (TRNDR) does not reorder.- Arabic copy example: "فريق TRNDR بيراجع كل طلب انضمام. هتشوف القرار هنا وفي سجل النشاط."
Tokens
--sky, --sky-ink, --butter, --butter-ink, --lime-50, --olive, --rasp-50, --rasp-ink.
Accessibility
role="status"for info / warn / lime,role="alert"for bad. Render an alert only when the condition happens, not on every page load if it is permanent.- The icon is decorative (
aria-hidden); the text must carry the meaning. - Text and ink pairs (
--sky-inkon--sky,--rasp-inkon--rasp-50, …) are the mock's AA pairs.
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
ToastRegion: a transient confirmation.BundleResultBanner,TopUpResultBanner: banners preset for a purchase result.ViewAsBanner(PR Portal): the "View as brand" strip; it draws the mock's.banner.ink, the toneBannerdoes not have.CalloutCard: a tinted card with a title and call to action.
See also: Icon · Button · AsyncBlock · Skeleton
Source
src/kit/patterns/Banner.tsx (line 17) on GitHub.