Skip to Content
BBRICKSv0.7.4
KitLists and tables

BulkBar

The bar over a selectable table: the count, then the actions (children). Hidden with nothing selected, unless persistent (Videos, Join requests show it always, buttons disabled).

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

Examples

Selection bar

A region that says how many rows are selected and holds the actions for them; it is hidden at 0 unless persistent.

Code
import { BulkBar, Button } from '@ergasti/bricks';

function Selected() {
  return (
    <div style={{ display: 'grid', gap: 12 }}>
      <BulkBar count={2}><Button size="sm">Reject</Button><Button size="sm" variant="ink">Approve</Button></BulkBar>
      <BulkBar count={0} persistent><Button size="sm" disabled>Approve</Button></BulkBar>
    </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 bulkBar, or with the component's own prop where it has one. A {name} is a value the component fills in.

bulkBar
KeyEnglishArabic
regionBulk actionsإجراءات جماعية
noneNone selectedمفيش حاجة متحددة
count{n} selected{n} متحدد

Design guidance

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

The bar that sits over a selectable table, showing how many rows are selected and the actions that apply to them; use it with a DataTable in selection mode.

BulkBar draws a tinted bordered strip with the live count ("2 selected") at the start and your action buttons after it. It is hidden while nothing is selected unless persistent, which keeps it visible with "None selected" (for lists where the actions should stay discoverable, with the buttons disabled). The count is in a polite live region, so selecting a row is announced.

Anatomy

  1. Region (div.kit-bulk, role="region", aria-label="Bulk actions"): flex, wraps, 8px gap, padding 10px 12px, 12px radius, accent-tint fill and accent border; 16px below it.
  2. Count (span.kit-bulk-n, aria-live="polite"): 13px 600, pushes the actions to the end.
  3. Actions: children (usually Button size="sm").

Variants

PropValueBehaviourWhen
persistentfalse (default)Renders nothing at count === 0Most tables
persistenttrueAlways shown; "None selected" at 0Join requests, review queues

The PR theme restyles it through --bulk-* tokens; the PR Portal also has its own PrBulkBar.

States

StateTriggerLook
Hiddencount 0, not persistentnull
None selectedcount 0, persistent"None selected" / "مفيش حاجة متحددة"
Selectedcount > 0"2 selected" / "2 متحدد"

Usage

interface JoinRequest { id: number; name: string; handle: string }
const requests: JoinRequest[] = [{ id: 1, name: 'Laila Saeed', handle: '@laila.saeed' }, { id: 2, name: 'Karim Hosny', handle: '@karim' }];
const columns: DataColumn<JoinRequest>[] = [
  { key: 'name', label: 'Creator', primary: true, render: (r) => <b>{r.name}</b> },
  { key: 'handle', label: 'Handle', tone: 'muted', render: (r) => r.handle },
];

function JoinRequests() {
  const [selected, setSelected] = useState<ReadonlySet<string | number>>(new Set());
  return (
    <>
      <BulkBar count={selected.size}>
        <Button size="sm">Reject</Button>
        <Button size="sm" variant="ink">Approve</Button>
      </BulkBar>
      <DataTable label="Join requests" rows={requests} rowKey={(r) => r.id} columns={columns}
        selection={{ selected, onChange: setSelected, rowLabel: (r) => r.name }} />
    </>
  );
}

Always visible, buttons disabled at zero:

<BulkBar count={selected.size} persistent>
  <Button size="sm" disabled={selected.size === 0}>Reject</Button>
  <Button size="sm" variant="ink" disabled={selected.size === 0}>Approve</Button>
</BulkBar>

Where it appears

  • Not drawn by the v3 Brand mock: Brand › Creators › Join requests has no row or bulk actions (they sit "With TRNDR"). BulkBar is the generic kit bar for any selectable DataTable.
  • PR Portal › Approvals › Join requests and New creators use PrBulkBar (the mock's .bulk: "Reject", then "Approve N" in lime), built on the same idea.
  • Kit gallery; screen PR · Approvals shows PrBulkBar.

Guidelines

Do

  • Put it directly above the table it acts on.
  • Keep 1–3 actions; destructive one first, primary last.

Don't

  • Don't put page-level actions in it.

RTL and Arabic

  • The count sits at the inline start (right in Arabic), actions at the end.

Tokens

--bulk-line, --bulk-radius, --bulk-bg, --bulk-ink, --color-accent-border, --color-accent-tint.

Accessibility

  • A named region ("Bulk actions" / "إجراءات جماعية") so screen-reader users can jump to it.
  • The count sits in an aria-live="polite" span. With persistent={false} the bar (and its live region) mounts together with the first count, so the first "1 selected" is often not announced; later changes ("2 selected") are. Use persistent when every change, the first included, must be announced.
  • The actions are your Buttons: give them names that say what they act on ("Approve 2 creators") if the visible text is short.
  • Order follows the reading order: count, then actions; nothing traps focus.

Found in the source

  • Roles in the markup: region.
  • ARIA attributes set: aria-label, aria-live.

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

See also: Button · CopyLink · CreatorCell · FilterChips

Source

src/kit/BulkBar.tsx (line 10) on GitHub.

On this page