ViewAsBanner
The "View as brand" bar (.banner.ink): what PR is looking at, and the way out.
import { ViewAsBanner } from '@ergasti/bricks';Examples
Brand page header
Name, program status, wallet health (with the day when it is below zero), meta lines, back and actions. Under it, the "view as brand" banner.
Code
import { Button, BrandDetailHeader, ViewAsBanner } from '@ergasti/bricks';
function Header() {
return (
<div style={{ display: 'grid', gap: 12 }}>
<BrandDetailHeader name="Kemet Home" color="#3D5A10" status="active" health="negative" healthDay={4} meta={['Since 5 Oct 2026', '12% of sale']} onBack={() => {}} actions={<><Button>View as brand</Button><Button variant="ink">New challenge</Button></>} />
<ViewAsBanner brandName="Kemet Home" onExit={() => {}} />
</div>
);
}Brand wallet
Available, held and balance, the wallet's health, and the TRNDR fee (default or the brand's own) with adjust and change actions.
Code
import { BrandWalletCard } from '@ergasti/bricks';
function Wallet() {
return (
<div style={{ display: 'grid', gap: 16, gridTemplateColumns: 'repeat(auto-fit, minmax(320px, 1fr))' }}>
<BrandWalletCard available="-8400.00" held="1200.00" balance="-7200.00" leftPercent={0} health="negative" healthDay={4} feePercent="5" feeIsDefault onAdjust={() => {}} onChangeFee={() => {}} />
<BrandWalletCard available="43390.00" held="18450.00" balance="61840.00" leftPercent={62} health="ok" feePercent="4" feeIsDefault={false} onAdjust={() => {}} onChangeFee={() => {}} />
</div>
);
}Back to your own list
backLabel names the crumb when the list it goes back to is not "Brands" (here a PR's own brands); a paused program with a low wallet.
Code
import { BrandDetailHeader } from '@ergasti/bricks';
function BackLabel() {
return <BrandDetailHeader name="Mira Beauty" color="#5B3BB0" status="paused" health="low" meta={['Since 2 Sep 2026', '8% of sale', 'PR owner: Mona']} onBack={() => {}} backLabel="My brands" />;
}How brands top up
The note under the buttons says how a brand can add money: the default topUpMethods="card-or-bank" reads "Brands top up by card (Paymob) or bank transfer."; "card" reads "Brands top up by card (Paymob)." for a market where bank transfers are off (the PR mock's brand page). Default on the left.
Code
import { BrandWalletCard } from '@ergasti/bricks';
function TopUpMethods() {
return (
<div style={{ display: 'grid', gap: 16, gridTemplateColumns: 'repeat(auto-fit, minmax(320px, 1fr))' }}>
<BrandWalletCard available="43390.00" held="18450.00" balance="61840.00" leftPercent={62} health="ok" feePercent="5" feeIsDefault onAdjust={() => {}} onChangeFee={() => {}} />
<BrandWalletCard available="43390.00" held="18450.00" balance="61840.00" leftPercent={62} health="ok" feePercent="5" feeIsDefault onAdjust={() => {}} onChangeFee={() => {}} topUpMethods="card" />
</div>
);
}Wallet in Arabic, card top-ups only
The figures read through Money, the note "البراندات بتشحن بالكارت (Paymob)."
Code
import { BrandWalletCard } from '@ergasti/bricks';
function TopUpCardArabic() {
return <BrandWalletCard available="12500.00" held="3200.00" balance="15700.00" leftPercent={18} health="low" feePercent="4" feeIsDefault={false} onAdjust={() => {}} onChangeFee={() => {}} topUpMethods="card" />;
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key prBrandDetail, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
crumbs | Breadcrumb | مسار الصفحة |
brands | Brands | البراندات |
owner | PR owner | مسؤول الـ PR |
you | (you) | (إنت) |
since | Since {d} | من {d} |
wallet | Wallet | المحفظة |
available | Available | المتاح |
held | Held for orders | محجوز للطلبات |
balance | Balance | الرصيد |
left | Left of last top-up | الباقي من آخر شحنة |
fee | TRNDR fee | رسوم TRNDR |
feeDefault | (default) | (الافتراضي) |
feeBrand | (this brand) | (للبراند ده) |
adjust | Adjust wallet | عدّل المحفظة |
changeFee | Change fee | غيّر الرسوم |
topups | Brands top up by card (Paymob) or bank transfer. | البراندات بتشحن بالكارت (Paymob) أو بتحويل بنكي. |
topupsCard | Brands top up by card (Paymob). | البراندات بتشحن بالكارت (Paymob). |
leftPct | {p}% left of the last top-up | فاضل {p}% من آخر شحنة |
viewing | [object Object] | [object Object] |
exit | Exit view | اخرج من العرض |
Design guidance
How the BRICKS design system uses ViewAsBanner. Written in docs/content/components/ViewAsBanner.md; the props above are read from the code, which wins where the two disagree.
The dark "View as brand" bar: an eye icon, "You're viewing as Kemet Home. Buttons are disabled." and "Exit view"; show it at the top of the brand dashboard while a PR member views it as that brand.
It is the PR mock's .banner.ink. It carries role="status", but it mounts together with its text, so screen readers may not announce it when it appears; move focus or announce the mode change from your app if that matters.
Anatomy
- Bar (
.kit-pr-viewas,role="status"): ink background, inverted text, radius--radius-lg, 12px × 16px, 16px below. - Eye icon (18px).
- Sentence (grows, min 180px): brand name in bold.
- Button: small "Exit view".
Variants
One look (.banner.ink: ink fill, inverted text). The sentence and button follow language: "You’re viewing as Kemet Home. Buttons are disabled." / "Exit view", "إنت بتتفرج كأنك Kemet Home. الزراير مقفولة." / "اخرج من العرض".
States
| State | How |
|---|---|
| Viewing | Rendered while the app is in view-as mode, first in the brand dashboard's main content. |
| Brand actions disabled | The banner promises "Buttons are disabled": the app must render the brand's own controls (Top up, Invite, Approve…) disabled while it shows. The banner does not do this itself. |
| Narrow | The sentence (min 180px) wraps the button under it. |
| Exit | "Exit view" calls onExit; the app removes the banner and returns to the PR brand page. |
See the full screen in the screen PR · View as brand.
Usage
{viewAs && (
<ViewAsBanner brandName="Kemet Home" onExit={() => { setViewAs(null); navigate('/brands/kemet'); }} />
)}
<BrandHomeScreen readOnly />Where it appears
- PR Portal › Brands › Brand detail › "View as brand" → the brand's dashboard with this bar on top (gallery screen
viewas). Screens: PR · View as brand; entry point PR · Brand.
Guidelines
Do
- Disable the brand's actions while it shows (the sentence promises it).
- Keep it first in the main content.
Don't
- Don't let it scroll away on long pages if your layout allows a sticky top.
RTL and Arabic
- "إنت بتتفرج كأنك {brand}. الزراير مقفولة." and "اخرج من العرض"; the icon sits on the right.
Tokens
--ink, --color-text-inverted, --radius-lg.
Accessibility
role="status"mounted with its content: not reliably announced on arrival (a live region must exist before its text changes). Announce the switch yourself, e.g. through the app's toast region.- The eye icon is decorative; the sentence names the brand in bold text, and "Exit view" is a real button with visible words.
- Inverted text on ink is high contrast. Disabled brand controls below it should use native
disabled(oraria-disabledwith a reason) so assistive tech also knows they are off.
Found in the source
- Roles in the markup:
status. - ARIA attributes set:
aria-label,aria-hidden,aria-current.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
BrandDetailHeader: where "View as brand" starts.Banner: other notices.
See also: Button · Money · MoneyNote · BrandAvatar · PrIcon · PrStatusPill · WalletHealthPill · useLanguage · BrandWalletCard · AdjustWalletDialog · BrandCell
Source
src/pr/BrandDetail.tsx (line 151) on GitHub.