DetailsBars
A list of labelled bars: a score's parts, a split by platform. Put it in a card of its own inside a drawer (the PR creator drawer's "TRNDR score" card: <Card variant="inset">), or anywhere a short bar list fits. The bars are decoration (aria-hidden); the label and value are the text.
import { DetailsBars } from '@ergasti/bricks';Examples
Inline bars
A list of labelled bars: the label, an 8px bar and the value on one row (a split by platform). label names the list for screen readers; the bars themselves are decoration.
Code
import { DetailsBars } from '@ergasti/bricks';
function Inline() {
return (
<div style={{ maxWidth: 360 }}>
<DetailsBars label="Followers" bars={[{ label: 'Instagram', value: '143K', percent: 30 }, { label: 'TikTok', value: '310K', percent: 70 }]} />
</div>
);
}Stacked score rows
variant="stacked" draws the PR Portal's score rows: the bold label, a muted note and the value on one line, a thin bar under it and a line between rows; a zero still shows a sliver of bar. Put it in a Card variant="inset" inside a drawer, as the PR creator drawer's TRNDR score card.
Code (not run)
import { Card, DetailsBars } from '@ergasti/bricks';
function Stacked() {
return (
<div style={{ maxWidth: 360 }}>
<Card variant="inset" title="TRNDR score" headingLevel={3}>
<DetailsBars variant="stacked" label="TRNDR score" bars={[
{ label: 'Sales', note: 'EGP 18.2K in 90 days', value: '30 / 35', percent: 86 },
{ label: 'Engagement', note: '3.1%', value: '14 / 20', percent: 70 },
{ label: 'On-time posting', note: 'no posts yet', value: '0 / 15', percent: 0 },
]} />
</Card>
</div>
);
}Props
Prop
Type
Design guidance
How the BRICKS design system uses DetailsBars. Written in docs/content/components/DetailsBars.md; the props above are read from the code, which wins where the two disagree.
A short list of labelled horizontal bars (a score's parts, followers by platform); use it inside a drawer or an inset card to show how a total splits.
Two layouts: inline puts label, an 8px bar and the value on one row (the DetailsDrawer section bars, e.g. followers by platform); stacked is the PR Portal v3 mock's score rows (pulseRows): bold label with a muted note and the value on one 13px line, a 6px bar underneath, a hairline between rows. The bars are decoration; the label and value carry the meaning.
Anatomy
- List:
ul.kit-dd-bars(--stackedmodifier), named bylabel. - Row
li: inline = 3-column grid (minmax(90px, auto) 1fr auto, 12px gap); stacked = block, 8px padding,--linebottom border. - Label:
.kit-dd-bar-l, optional 15pxicon+label(600, or 700 in stacked). - Note (stacked only):
.kit-dd-bar-n, "· EGP 18.2K in 90 days", 12px--ink-3. - Value:
<b dir="ltr">("30 / 35", "143K"). - Track + fill:
.kit-dd-bar-t(aria-hidden), 8px--softtrack with--raspfill (inline) or 6px--tracktrack 6px under the line (stacked).
Variants
variant | Look | When to use |
|---|---|---|
'inline' (default) | One row: label · 8px bar · value; 10px between rows | Splits inside a DetailsDrawer section (followers by platform). |
'stacked' | Label + note + value line, 6px bar under it, hairline rows; a 0 still draws 2% | Score breakdowns (PR creator drawer "TRNDR score"). |
States
| State | Trigger |
|---|---|
| Zero | percent: 0: empty bar (inline) or a 2% sliver (stacked). |
| Over 100 / negative | clamped to 0–100. |
| Note | note set; drawn in stacked only. |
| Long label | wraps in its column; the value stays on one line. |
Types
| Field | Type | Required | Description |
|---|---|---|---|
label | ReactNode | yes | Row label ("Sales", "Instagram"). |
value | ReactNode | yes | Shown value ("30 / 35"). |
percent | number | yes | Bar width, 0–100. |
icon | ReactNode | no | 15px icon before the label (platform glyph). |
note | ReactNode | no | Muted part after the label; stacked only. |
Usage
// PR Portal › Creators › creator drawer › TRNDR score
<Card variant="inset" title="TRNDR score" headingLevel={3} badge={<b>62 / 100</b>}>
<DetailsBars variant="stacked" label="TRNDR score" bars={[
{ label: 'Sales', note: 'EGP 18.2K in 90 days', value: '30 / 35', percent: 86 },
{ label: 'Engagement', note: '3.1%', value: '14 / 20', percent: 70 },
{ label: 'On-time posting', value: '0 / 15', percent: 0 },
]} />
<p className="kit-muted">Score = points earned ÷ points we can measure × 100.</p>
</Card>// Followers by platform
<DetailsBars label="Followers" bars={[
{ label: 'Instagram', icon: <Icon name="ig" />, value: '143K', percent: 30 },
{ label: 'TikTok', icon: <Icon name="tt" />, value: '310K', percent: 70 },
]} />Where it appears
- In the v3 mocks: PR Portal › Creators › creator drawer › TRNDR score card (the mock's
pulseRows;stackedinCard variant="inset") (PrCreatorDrawer). - Library: any
DetailsDrawersection givenbars(inline).
Guidelines
Do
- Keep to 2–6 rows; order them by the meaning of the score, not by size.
- Put the exact value in
value; the bar is only a hint.
Don't
- Don't use it for time series or for more than one measure per row; use
HBarsor a chart. - Don't colour bars by status; the fill is always the accent.
RTL and Arabic
- Grid and flex mirror: label at the inline start, value at the inline end, bars grow from the inline start.
- Values are
dir="ltr"("30 / 35"); stacked lines use--lh-arfor Arabic line height.
Tokens
--rasp (fill), --soft (inline track), --track (stacked track), --line, --ink-3, --lh-ar.
Accessibility
- A
<ul>named bylabel; each<li>reads "label, note, value". - Bars are
aria-hidden, so never rely on the bar alone.
Found in the source
- ARIA attributes set:
aria-label,aria-hidden. - Its tests cover: “inline (default): label, bar and value on one row; the note is not drawn”; “stacked: label, muted note and value on one line, and a zero still shows a 2% bar”; “label is optional: no accessible name is set without it; values stay left-to-right”.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
DetailsDrawer: renders these bars in its sections.FollowerBars: the brand creator profile's follower split.HBars: a chart of bars across items.ProgressRow: one labelled progress bar.
See also: Card · DialogSkeleton · Drawer · Modal
Source
src/kit/patterns/DetailsBars.tsx (line 32) on GitHub.