IconSquare
The mock's .ico: a 40px tinted square with an icon (38 in choices, 52 in empty states).
import { IconSquare } from '@ergasti/bricks';Examples
Every PR icon
The portal's line icons (PR_ICONS) as plain icons and as tinted squares in the six tones.
Code
import { IconSquare, PR_ICONS, PrIcon, type PrIconName } from '@ergasti/bricks';
function All() {
const names = Object.keys(PR_ICONS) as PrIconName[];
return (
<div style={{ display: 'grid', gap: 16 }}>
<ul style={{ listStyle: 'none', margin: 0, padding: 0, display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(96px, 1fr))', gap: 8 }}>
{names.map((name) => <li key={name} style={{ display: 'grid', justifyItems: 'center', gap: 4, padding: 8, background: 'var(--card)', borderRadius: 12 }}><PrIcon name={name} size={22} /><code style={{ fontSize: 11 }}>{name}</code></li>)}
</ul>
<div style={{ display: 'flex', gap: 10, flexWrap: 'wrap', alignItems: 'center' }}>
{(['rasp', 'butter', 'sky', 'lime', 'lilac', 'mute'] as const).map((tone) => <IconSquare key={tone} name="star" tone={tone} />)}
<IconSquare name="wallet" tone="rasp" size="sm" /><IconSquare name="wallet" tone="sky" size="lg" />
</div>
</div>
);
}The gift glyph
gift (0.7.0) is the mock's gift box, for gift stock rows, nav items and an IconSquare, so a gift row no longer needs the kit Icon as an element.
Code
import { IconSquare, PrIcon } from '@ergasti/bricks';
function Gift() {
return (
<div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
<PrIcon name="gift" size={22} />
<IconSquare name="gift" tone="lime" />
<IconSquare name="gift" tone="lilac" size="lg" />
</div>
);
}Props
Prop
Type
Design guidance
How the BRICKS design system uses IconSquare. Written in docs/content/components/IconSquare.md; the props above are read from the code, which wins where the two disagree.
A tinted rounded square holding one PR icon; use it as the decorative lead of a task row, a choice card or an empty state in the PR Portal.
IconSquare is the PR mock's .ico: a 40px square in one of six soft tone pairs with an 18px stroke icon centred in it. It gives rows and cards a coloured anchor without adding words, so the label beside it always carries the meaning. In the mock it leads the Home "To review" rows, the "How creators earn" choice cards, the empty states ("All clear") and the tier and fraud rows.
Anatomy
- Square: a
<span aria-hidden="true">grid cell,40 × 40(md),38 × 38(sm) or52 × 52(lg), radius--radius-md(--radius-lgatlg). - Tone fill: background and icon colour from the
tonepair (kit-pr-tone--<tone>). - Icon: a
PrIcon(24-unit viewBox, 2px round stroke,currentColor), 18px (22px atlg).
Variants
| Prop | Value | Look | When to use |
|---|---|---|---|
tone | rasp | raspberry tint, raspberry ink | Money at risk, challenges, urgent rows |
butter | butter yellow, butter ink | Warnings, things waiting | |
sky | sky blue, sky ink | Neutral info, brand-side items | |
lime | lime tint, olive icon | Success, "All clear", approvals | |
lilac | lilac, lilac ink | Messages, tiers | |
mute | soft grey, --ink-2 | Secondary or inactive items | |
size | sm | 38px square | Choice cards (ChoiceGroup) |
md (default) | 40px square | Task rows, list leads | |
lg | 52px square, 22px icon, larger radius | Empty states (PrEmpty) |
States
Static: no hover, focus or disabled state. It inherits interaction from its parent (a clickable TaskRow or ChoiceGroup option).
Types
PrTone (tone): 'rasp' | 'butter' | 'sky' | 'lime' | 'lilac' | 'mute'.
Usage
import { IconSquare } from '@ergasti/bricks';
<IconSquare name="trophy" tone="rasp" />// Home › "To review": a task row led by a tinted square
<TaskRow
lead={<IconSquare name="trophy" tone="butter" />}
title="Weekend sprint ends in 2 days"
meta="Glow Lab · 18 creators joined"
onOpen={() => openChallenge('weekend-sprint')}
/>// The large square in an empty state (PrEmpty draws it for you)
<IconSquare name="party" tone="lime" size="lg" />Every PR icon. The portal's line icons (PR_ICONS) as plain icons and as tinted squares in the six tones. (docs example All)
import { IconSquare, PR_ICONS, PrIcon, type PrIconName } from '@ergasti/bricks';
export function All() {
const names = Object.keys(PR_ICONS) as PrIconName[];
return (
<div style={{ display: 'grid', gap: 16 }}>
<ul style={{ listStyle: 'none', margin: 0, padding: 0, display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(96px, 1fr))', gap: 8 }}>
{names.map((name) => <li key={name} style={{ display: 'grid', justifyItems: 'center', gap: 4, padding: 8, background: 'var(--card)', borderRadius: 12 }}><PrIcon name={name} size={22} /><code style={{ fontSize: 11 }}>{name}</code></li>)}
</ul>
<div style={{ display: 'flex', gap: 10, flexWrap: 'wrap', alignItems: 'center' }}>
{(['rasp', 'butter', 'sky', 'lime', 'lilac', 'mute'] as const).map((tone) => <IconSquare key={tone} name="star" tone={tone} />)}
<IconSquare name="wallet" tone="rasp" size="sm" /><IconSquare name="wallet" tone="sky" size="lg" />
</div>
</div>
);
}Where it appears
- PR Portal › Home › "To review" task rows (lead square).
- PR Portal › Affiliate programs › Campaigns › a campaign's page › "How creators earn" choice cards (via
ChoiceGroup,sm). - PR Portal › Home / Approvals › "All clear" empty state (via
PrEmpty,lg). - PR Portal › Tiers › recent moves; Affiliate programs › Campaigns › a campaign's page (challenges and change requests). Also library-only fraud review rows.
- Dashboard screens: PrHome, PrPrograms, PrTiers.
Guidelines
Do
- Put a text label next to it: the square is hidden from assistive technology.
- Match the tone to the meaning of the row (lime for done, butter for waiting, rasp for money or risk).
- Use
lgonly in empty states; keep rows atmd.
Don't
- Don't use it as a button; wrap the whole row or card instead.
- Don't mix more than three tones in one short list; the colour stops meaning anything.
- Don't pass an icon name outside
PR_ICONS(it is typed): for kit icons useIcon.
RTL and Arabic
Nothing mirrors: icons such as arrow and chev are drawn left-to-right and do not flip inside the square. In a row the square moves to the inline start (right) with the layout.
Tokens
--radius-md, --radius-lg, --rasp-50, --rasp-ink, --butter, --butter-ink, --sky, --sky-ink, --lime-50, --olive, --lilac, --lilac-ink, --soft, --ink-2.
Accessibility
- Rendered
aria-hidden="true"; the inner svg is alsoaria-hiddenandfocusable="false". - Never the only carrier of meaning: the label beside it says what the tone implies.
- Tone pairs are the mock's tinted fills with their ink colours; the icon is decorative so no text contrast rule applies.
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
PrIcon: the bare icon, for inline use in buttons and banners.PrEmpty: the empty state that draws algIconSquare.BrandAvatar: a brand's own square (initials or logo) when the lead is a brand, not a kind of thing.Icon(kit): the shared icon set for non-PR surfaces.
See also: DecisionLine · DecisionTag · DecisionTagsProvider · PrCountPill
Source
src/pr/PrIcon.tsx (line 63) on GitHub.