AudienceLabel
The PR mock's audience label (.to): everyone is the dark chip with the people icon; a brand is its own colour with a small "Brand" prefix; a tier takes its tier pair with "Tier"; picked creators show the first photo and name, then "+N". The prefix is part of the text, so the kind is read, not only seen.
import { AudienceLabel } from '@ergasti/bricks';Examples
Message table cells
Who a message went to, who sent it (a brand, or TRNDR when null) and the open rate; the building blocks of the messages table preset.
Code
import { AudienceLabel, OpenRate, SenderCell } from '@ergasti/bricks';
import { brands } from './pr';
function Cells() {
return (
<div style={{ display: 'grid', gap: 12 }}>
<AudienceLabel audience={{ kind: 'all' }} />
<AudienceLabel audience={{ kind: 'brand', brand: brands.glow }} />
<AudienceLabel audience={{ kind: 'tier', tier: 'elite' }} />
<AudienceLabel audience={{ kind: 'group', name: 'Top sellers' }} />
<AudienceLabel audience={{ kind: 'picked', creators: [{ name: 'Nour Hassan', seed: 2 }, { name: 'Hana Rami', seed: 6 }] }} />
<div style={{ display: 'flex', gap: 24 }}><SenderCell brand={brands.mira} /><SenderCell brand={null} /><OpenRate percent={71} /></div>
</div>
);
}The mock's history table cells
SenderCell draws the mock's 28px square for brands and TRNDR (avatarSize="md" for the 38px one); OpenRate writes "62%" as one figure beside its bar.
Code
import { OpenRate, SenderCell } from '@ergasti/bricks';
import { brands } from './pr';
function SenderAndOpenRate() {
return (
<div style={{ display: 'grid', gap: 12 }}>
<div style={{ display: 'flex', gap: 24, alignItems: 'center' }}><SenderCell brand={brands.glow} /><SenderCell brand={null} /><SenderCell brand={brands.glow} avatarSize="md" /></div>
<div style={{ display: 'flex', gap: 24, maxWidth: 360 }}><OpenRate percent={62} /><OpenRate percent={100} /></div>
</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 prMessageCells, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
all | All TRNDR creators | كل صنّاع المحتوى على TRNDR |
brand | Brand | براند |
group | Group | مجموعة |
tier | Tier | مستوى |
more | +{n} | +{n} |
opened | {p}% opened | اتفتحت {p}% |
trndr | TRNDR | TRNDR |
Design guidance
How the BRICKS design system uses AudienceLabel. Written in docs/content/components/AudienceLabel.md; the props above are read from the code, which wins where the two disagree.
A pill that says who a message went to: all creators, a brand's creators, a group, a tier, or creators picked by hand; use it in the Messages history table's "To" column and the message drawer.
AudienceLabel is the PR mock's .to. Every kind has its own look, and a small prefix ("BRAND", "GROUP", "TIER") is part of the text, so the kind is read, not only seen. The same Audience value drives the composer's AudiencePicker, so what PR picked is exactly what the history shows.
Anatomy
- Pill:
<span class="kit-pr-to kit-pr-to--<kind>">, 12px / 700, padding4px 11px, radius 99px, no wrap (wraps under 600px). - Lead:
all: a 13px people icon;picked: the first creator's 22px photo. - Prefix (
brand,group,tier): a 10px upper-case<em>with a rule after it. - Name: "All TRNDR creators", the brand's or group's name, the tier's name, or the first picked creator.
- More (
picked): muted "+N".
Variants
audience.kind | Look | Text |
|---|---|---|
all | Ink pill, inverted text, people icon | All TRNDR creators |
brand | The brand's colour at 9% over the card, its colour (82%) as text | BRAND · Glow Lab |
group | Lilac | GROUP · Beauty lovers |
tier | The tier's pair (rising, established, influential, elite) | TIER · Elite |
picked | White with a --line border, first photo | Nour Hassan +3 |
States
Static. picked with no creators shows a muted "—". A brand without color uses ink.
Types
Words: provider labels.prMessageCells (all, brand, group, tier, more(n)).
Audience: { kind: 'all' }, { kind: 'brand', brand: StackBrand }, { kind: 'group', name }, { kind: 'tier', tier: PrTier }, { kind: 'picked', creators: PrPerson[] }.
Usage
import { AudienceLabel } from '@ergasti/bricks';
<AudienceLabel audience={{ kind: 'brand', brand: { id: 'glow', name: 'Glow Lab', color: '#C7325C' } }} />
<AudienceLabel audience={{ kind: 'tier', tier: 'elite' }} />// Messages › history: messageColumns puts AudienceLabel, SenderCell and OpenRate in their columns
<Card title="Sent messages">
<DataTable label="Sent messages" rows={messages} rowKey={(m) => m.id} columns={messageColumns('en')} onRowClick={openMessage} />
</Card>// The message drawer: "To" line
<KeyValue items={[{ label: 'To', value: <AudienceLabel audience={msg.audience} /> }, { label: 'Creators', value: '86' }]} />Message table cells. Who a message went to, who sent it (a brand, or TRNDR when null) and the open rate; the building blocks of the messages table preset. (docs example Cells)
import { AudienceLabel, OpenRate, SenderCell } from '@ergasti/bricks';
// brands: the docs' sample rows (docs/examples/_pr.ts), e.g. brands.glow = { id: 'glow', name: 'Glow Lab', color: '#C7325C' }
export function Cells() {
return (
<div style={{ display: 'grid', gap: 12 }}>
<AudienceLabel audience={{ kind: 'all' }} />
<AudienceLabel audience={{ kind: 'brand', brand: brands.glow }} />
<AudienceLabel audience={{ kind: 'tier', tier: 'elite' }} />
<AudienceLabel audience={{ kind: 'group', name: 'Top sellers' }} />
<AudienceLabel audience={{ kind: 'picked', creators: [{ name: 'Nour Hassan', seed: 2 }, { name: 'Hana Rami', seed: 6 }] }} />
<div style={{ display: 'flex', gap: 24 }}><SenderCell brand={brands.mira} /><SenderCell brand={null} /><OpenRate percent={71} /></div>
</div>
);
}Where it appears
- PR Portal › Messages › history table, "To" column.
- PR Portal › Messages › message drawer (from / to, "Send another to the same people").
Guidelines
Do
- Store the audience as the
Audiencevalue the composer produced and show it unchanged. - Pass the brand's own colour so the pill matches its square elsewhere.
Don't
- Don't write the creator count inside the pill; it has its own column.
- Don't use it for anything but message audiences.
RTL and Arabic
The prefix's rule sits on the inline end; Arabic prefixes are not upper-cased. Arabic words come from the copy and the tier table; "+N" stays dir="ltr".
Tokens
--ink, --color-text-inverted, --card, --line, --lilac, --lilac-ink, --tier-rising-bg, --tier-rising-ink, --tier-established-bg, --tier-established-ink, --tier-influential-bg, --tier-influential-ink, --tier-elite-bg, --tier-elite-ink, --to-c (set from the brand colour).
Accessibility
Text carries the kind (the prefix is real text). Icons and photos are decorative. Under 600px the pill wraps instead of overflowing.
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
AudiencePicker: where the audience is chosen.SenderCell/OpenRate: the other history cells.TierChip: a tier on its own.
See also: Avatar · BrandAvatar · PrIcon · useBricks · useLanguage · AnnouncementComposer · ChannelPicker · MessageDrawer
Source
src/pr/MessageCells.tsx (line 24) on GitHub.