BrandCell
The mock's brand cell: the square, the name (bold, one line) and an optional sub line ("10% of sale"). title replaces the bold line when the row is about something of the brand's (a gift shipment, "GS-0017 · Glow Lab"); the square still takes its initials and colour from name.
import { BrandCell } from '@ergasti/bricks';Examples
Brand marks
A coloured initial tile in four sizes, the brand cell for tables (name, a sub line, a suffix) and an overlapping stack with a "+N" count.
Code
import { BrandAvatar, BrandCell, BrandStack, Pill } from '@ergasti/bricks';
import { brands } from './pr';
function Marks() {
return (
<div style={{ display: 'grid', gap: 14 }}>
<div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
{(['xs', 'sm', 'md', 'lg'] as const).map((size) => <BrandAvatar key={size} name="Glow Lab" color="#C7325C" size={size} />)}
</div>
<BrandCell name="Glow Lab" color="#C7325C" sub="10% of sale" suffix={<Pill tone="ok">Live</Pill>} />
<BrandStack brands={Object.values(brands)} max={3} />
</div>
);
}Props
Prop
Type
Design guidance
How the BRICKS design system uses BrandCell. Written in docs/content/components/BrandCell.md; the props above are read from the code, which wins where the two disagree.
A brand's table cell: the square avatar, the brand's name in bold on one line and an optional muted line ("10% of sale"); use it as the primary column of PR tables that list brands.
It is the PR mock's brand cell (.person with a .bav). title replaces the bold line when the row is about something of the brand's ("GS-0017 · Glow Lab"); the square still takes its initials and colour from name. suffix adds a pill or "(you)" inside the bold line.
Anatomy
- Wrapper (
.kit-pr-person): flex, the square then the text. - Square:
BrandAvatarmd (38px). - Bold line:
title ?? name, thensuffix; one line. - Sub (
.kit-pr-psub, optional): muted.
Variants
| Props | Look | Use when |
|---|---|---|
name + sub | Name over "8% of sale" | Brands / Programs tables. |
suffix | A pill after the name ("Mine") | Mark the user's brands. |
title | Another bold line, the brand's square | Shipments, requests of a brand. |
States
Long names truncate on one line (story LongName).
Usage
// PR Portal › Programs table
const columns: DataColumn<Program>[] = [
{ key: 'brand', label: 'Brand', primary: true, sortKey: 'name',
render: (p) => <BrandCell name={p.brand.name} color={p.brand.color} sub={`${p.commission}% of sale`} suffix={p.mine ? <Pill tone="lime">Mine</Pill> : null} /> },
{ key: 'status', label: 'Status', render: (p) => <PrStatusPill status={p.status} /> },
{ key: 'sales', label: 'Sales', align: 'end', render: (p) => <Money value={p.sales} /> },
];// A shipment of a brand
<BrandCell name="Glow Lab" color={glow.color} title="GS-0017 · Glow Lab" sub="40 units to check · Expected" />Where it appears
- PR Portal › Brands table and Programs table (primary column). Screens: PR · Brands, PR · Affiliate programs.
- PR Portal › Home "Needs attention" rows and gift shipments. Screens: PR · Home, PR · Gift stock.
Guidelines
Do
- Put the commission or owner in
sub. - Pass the brand's colour.
Don't
- Don't make the cell itself a link; make the row clickable.
RTL and Arabic
- Square on the right in Arabic; Latin brand names keep their direction.
Tokens
BrandAvatar tokens; .kit-pr-psub muted ink.
Accessibility
- Markup is plain text: a
<span>row with the bold name (<b>) and the sub line; no role, no heading, nothing focusable. In aDataTableprimary column the cell is the row's name, so keep the brand's name in it. - The square (
BrandAvatar) isaria-hidden; the initials are never read, so the bold line must name the brand. Withtitle, include the brand's name in it ("GS-0017 · Glow Lab"), sincenameis then only used for the square. suffixsits inside the bold line, so it is read as part of the name ("Glow Lab Mine"); use a pill with a real word, not an icon alone.- A long name is cut with an ellipsis visually only; the full name stays in the DOM for screen readers. Add a
titleattribute on the row if sighted users need the full name. - The square's white initials on the brand's own colour carry no meaning (decorative), but pick brand colours dark enough for the 3:1 non-text contrast of a visible shape.
Found in the source
- Roles in the markup:
img. - ARIA attributes set:
aria-hidden,aria-label.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
BrandAvatar,BrandStack,BrandLead.CreatorCell: the same for creators.
See also: useLanguage · Pill · AdjustWalletDialog · BrandDetailHeader · BrandFeeDialog
Source
src/pr/BrandAvatar.tsx (line 25) on GitHub.