Skip to Content
BBRICKSv0.7.4
BlocksShared

ProgressRow

The mock's prog() (or, with variant="bar", the PR mock's live challenge rows): a label, the muted "68 / 100" (with "· Done" in green once reached) and a row of pips. The pips are one image to AT. Spans only, so a row can sit inside a button (a bonus card, a gift row) ("Gifts taken: 68 of 100"), so the figure is never only in the drawing.

import { ProgressRow } from '@ergasti/bricks';

Examples

Progress row

A label, pips and "9 of 20"; at the goal it says "Done". strong emphasises the leader.

Code
import { ProgressRow } from '@ergasti/bricks';

function Rows() {
  return (
    <div style={{ display: 'grid', gap: 12, maxWidth: 420 }}>
      <ProgressRow label="Tarek Fathy" value={20} max={20} cells={20} strong />
      <ProgressRow label="Laila Saeed" value={17} max={20} cells={20} />
      <ProgressRow label="Salma Hosny" value={12} max={20} cells={20} tone="ink" />
    </div>
  );
}

Bars

variant="bar" is the PR portal's Home "Live challenges" rows: a bold title, the muted display line ("Glow · 6 days left") and an 8px raspberry bar on a grey track. The bar is one image to screen readers ("Glow Ramadan: 62 of 100").

Code
import { ProgressRow } from '@ergasti/bricks';

function Bars() {
  const rows = [
    { title: 'Glow Ramadan', brand: 'Glow', left: 6, prog: 62 },
    { title: 'Summer skin', brand: 'Nile Beauty', left: 1, prog: 88 },
    { title: 'Back to school', brand: 'Hush', left: 12, prog: 24 },
  ];
  return (
    <div style={{ maxWidth: 360 }}>
      {rows.map((r) => (
        <div key={r.title} style={{ padding: '10px 0', borderBottom: '1px solid var(--line)' }}>
          <ProgressRow variant="bar" label={r.title} display={`${r.brand} · ${r.left} day${r.left > 1 ? 's' : ''} left`} value={r.prog} max={100} />
        </div>
      ))}
    </div>
  );
}

Pips and bar, every tone

The two variants side by side in rasp, lime and ink; without display both show "value / max" and "Done" at the goal.

Code
import { ProgressRow } from '@ergasti/bricks';

function Variants() {
  const tones = ['rasp', 'lime', 'ink'] as const;
  return (
    <div style={{ display: 'grid', gap: 24, gridTemplateColumns: 'repeat(auto-fit, minmax(240px, 1fr))' }}>
      {(['pips', 'bar'] as const).map((variant) => (
        <div key={variant} style={{ display: 'grid', gap: 12 }}>
          {tones.map((tone) => <ProgressRow key={tone} variant={variant} tone={tone} label={`${variant} · ${tone}`} value={tone === 'ink' ? 20 : 13} max={20} />)}
        </div>
      ))}
    </div>
  );
}

Bar, in Arabic

The bar fills from the right and the figure reads in Arabic.

Pinned to Arabic
Code
import { ProgressRow } from '@ergasti/bricks';

function BarArabic() {
  return (
    <div dir="rtl" style={{ maxWidth: 360 }}>
      <ProgressRow variant="bar" label="جلو رمضان" display="جلو · فاضل 6 أيام" value={62} max={100} language="ar" />
    </div>
  );
}

Spoken name

When the label is not plain text (an avatar with a name), give name: screen readers hear "Nour Hassan: 14 of 20" instead of only "14 of 20".

Code
import { ProgressRow } from '@ergasti/bricks';

function SpokenName() {
  return (
    <div style={{ display: 'grid', gap: 12, maxWidth: 420 }}>
      <ProgressRow label={<b>Nour Hassan <span style={{ color: 'var(--ink-3)', fontWeight: 400 }}>@nour.h</span></b>} name="Nour Hassan" value={14} max={20} />
      <ProgressRow variant="bar" label={<b>Gifts taken</b>} name="Gifts taken" display="68 of 100" value={68} max={100} />
    </div>
  );
}

The figure in Arabic

The muted "8 / 20" is one left-to-right run, so it reads the same inside a right-to-left row, and "Done" (خلص) follows it once the goal is reached.

Pinned to Arabic
Code (not run)
import { ProgressRow } from '@ergasti/bricks';

function FigureRtl() {
  return (
    <div dir="rtl" style={{ display: 'grid', gap: 12, maxWidth: 420 }}>
      <ProgressRow label="هدايا اتاخدت" value={8} max={20} language="ar" />
      <ProgressRow label="الأيام" value={20} max={20} tone="ink" language="ar" />
    </div>
  );
}

Done from the server

done adds "· Done" when the server says the goal is met, whatever value and display show (a money goal shown as "EGP 5,000 / EGP 5,000"). Without it, Done follows value ≥ max, and a row with display never adds it.

Code
import { ProgressRow } from '@ergasti/bricks';

function DoneFromServer() {
  return (
    <div style={{ display: 'grid', gap: 12, maxWidth: 420 }}>
      <ProgressRow label="Tarek Fathy" value={5000} max={5000} display="EGP 5,000 / EGP 5,000" done tone="lime" />
      <ProgressRow label="Salma Hosny" value={3420} max={5000} display="EGP 3,420.50 / EGP 5,000" tone="lime" />
    </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 progressRow, or with the component's own prop where it has one. A {name} is a value the component fills in.

progressRow
KeyEnglishArabic
doneDoneخلص
of{value} of {max}{value} من {max}

Design guidance

How the BRICKS design system uses ProgressRow. Written in docs/content/components/ProgressRow.md; the props above are read from the code, which wins where the two disagree.

A labelled progress line: a label, a muted "68 / 100" figure (with "· Done" once reached) over a row of pips, or a bold title, a muted line and an 8px bar; use it for counts toward a target inside cards and drawers.

It is the brand mock's prog() (gifts taken, days of a window, a creator's sales toward a target) and, with variant="bar", the PR mock's Home "Live challenges" rows. It is made of spans only, so it can sit inside a clickable card button; the pips or bar are one image to assistive tech, named with the figure ("Gifts taken: 68 of 100").

Anatomy

Pips (default):

  1. Head (.kit-blk-prog-h, 13px): the label (start) and the figure (.kit-blk-prog-v, 12px --ink-3), "68 / 100" or your display, plus " · Done" in --ok.
  2. Pips: cells cells filled to value / max, in tone.

Bar (variant="bar"):

  1. Title (14px, 700).
  2. Line (display, muted, "Glow · 6 days left").
  3. Bar (.kit-blk-bar, 8px, --track with the fill in tone).

Variants

PropValueLookUse when
variant'pips' (default)Head over pipsBrand dashboard counts.
variant'bar'Title, line, 8px barPR Home "Live challenges".
tone'rasp' (default)Raspberry fillCreators' targets, challenges.
tone'lime'Lime fill (--chart-lime on bars)Gifts taken.
tone'ink'Ink fillDays of a window.
cells20 (default); 25 for gifts, 30 for daysPip countMatch the mock's scale.
strongtrueBold label, 14px gap below (none on the last row)Payout window and live challenge rows.
displaynodeReplaces "68 / 100" ("Day 13 of 30", "68 of 100 gift sets")Words or money instead of a bare ratio.

States

StateHow
In progressvalue < max.
Donevalue >= max (with no display), or done from the server: " · Done" in green. With display, Done shows only when done is passed.
Emptyvalue={0}: no pips filled.
Over targetPips/bar cap at full; the figure still says the real value.

Usage

<ProgressRow label="Gifts taken" value={68} max={100} cells={25} tone="lime" />
<ProgressRow label="Day" value={13} max={30} cells={30} tone="ink" display="Day 13 of 30" />
// PR Portal › Home › Live challenges card
<Card title="Live challenges" actions={<a className="kit-pr-link" href="#challenges">See all</a>}>
  <ul>
    <li><ProgressRow variant="bar" label="Winter top 10" display="Glow · 15 days left" value={50} max={100} /></li>
    <li><ProgressRow variant="bar" label="Sell 20 in November" display="Mira · 15 days left" value={50} max={100} /></li>
    <li><ProgressRow variant="bar" label="Weekend sprint" display="Kemet · 1 day left" value={66} max={100} /></li>
  </ul>
</Card>
// A creator toward a target, inside a clickable bonus card
<ProgressRow label={<CreatorCell id={7} name="Tarek Fathy" identity={identity} />} name="Tarek Fathy" value={20} max={20} />

Where it appears

  • Brand › Motivation › challenge and bonus cards and drawers (gifts taken, creators toward targets), gift stock list. Screens: Motivation, Motivation · Bonuses.
  • Brand › Home › live challenge card ("Day 4 of 11").
  • Brand › Payments › Payouts › payout window card. Screen: Payments · Payouts.
  • PR Portal › Home › "Live challenges" card (variant="bar"). Screen: PR · Home.

Guidelines

Do

  • Pass done from the server when "done" is not simply value >= max.
  • Use display for money or days, and keep the label short.
  • Pass name whenever label is an element, so the read-out has words.

Don't

  • Don't stack more than about five rows without a heading.
  • Don't use pips for percentages over 30 cells; use the bar.
  • Don't colour-code meaning beyond the three tones.

RTL and Arabic

  • Label and figure swap sides; pips and bar fill from the right.
  • Arabic: "خلص" (Done), "68 من 100" spoken.

Tokens

--ink-3 (figure), --ok (Done), --track (bar track), --rasp, --chart-lime, --ink (fills); Pips tokens.

Accessibility

  • The pips/bar are role="img" with a label such as "Gifts taken: 68 of 100"; the visible figure is also text.
  • "Done" is a word, not only green.
  • The figure is dir="ltr" so "68 / 100" never reverses.

Found in the source

  • Roles in the markup: img.
  • ARIA attributes set: aria-label.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

  • UsageMeter: a used-of-limit meter for seats in the shell.
  • Pips: the bare cell meter.
  • ShareBar: a share of a maximum in a table cell.
  • StatGrid: several figures without progress.

See also: useLanguage · CalloutCard · CheckList · CopyLinkField · DrawerHead

Source

src/blocks/shared/ProgressRow.tsx (line 48) on GitHub.

On this page