Skip to Content
BBRICKSv0.7.4
PR PortalForms and dialogs

PrBulkBar

The PR mock's .bulk: "N selected" and the actions on an ink pill (it replaces the toolbar's scope switch while rows are selected); tone="soft" is a light bar for a card. Hidden at 0 unless persistent. Actions go in children: BulkAction buttons (approve is lime, danger dark, plain white). The count is announced.

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

Examples

Bulk actions

A bar that says how many rows are selected, with a Clear button and your actions: plain, approve (the primary one) and danger. tone="soft" is the lighter bar.

Code
import { BulkAction, PrBulkBar } from '@ergasti/bricks';

function Bars() {
  return (
    <div style={{ display: 'grid', gap: 12 }}>
      <PrBulkBar count={3} onClear={() => {}}>
        <BulkAction kind="danger" onClick={() => {}}>Reject</BulkAction>
        <BulkAction kind="approve" onClick={() => {}}>Approve 3</BulkAction>
      </PrBulkBar>
      <PrBulkBar count={1} tone="soft" onClear={() => {}}><BulkAction onClick={() => {}}>Export</BulkAction><BulkAction kind="approve" disabled onClick={() => {}}>Approve 1</BulkAction></PrBulkBar>
    </div>
  );
}

Always shown

persistent keeps the bar drawn when nothing is selected (the count reads 0 and actions stay visible), for a page whose actions are always in reach.

Code
import { BulkAction, PrBulkBar } from '@ergasti/bricks';

function Persistent() {
  return <PrBulkBar count={0} persistent tone="soft"><BulkAction onClick={() => {}}>Export all</BulkAction></PrBulkBar>;
}

Props

Prop

Type

Labels

Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key prBulkBar, or with the component's own prop where it has one. A {name} is a value the component fills in.

prBulkBar
KeyEnglishArabic
regionBulk actionsإجراءات جماعية
selected{n} selected{n} متحدد
clearClear selectionالغي التحديد

Design guidance

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

The PR Portal's bulk-action bar: "N selected", a clear button and bulk actions on an ink (or soft) pill; use it above a selectable table while rows are selected.

PrBulkBar is the PR mock's .bulk. In the Approvals queue it replaces the toolbar's scope switch as soon as PR ticks rows, and offers "Reject" and "Approve 2" for all of them at once. It hides itself at zero unless persistent. Actions go in as BulkAction children, which come in the mock's three looks.

Anatomy

  1. Region: <div role="region" aria-label="Bulk actions">, an inline-flex pill (radius 99px, padding 6px, 18px at the inline start), fades in over 150ms.
  2. Count: "{n} selected", 600 weight, aria-live="polite".
  3. Clear (with onClear and n > 0): a 28px round "×" button, label "Clear selection".
  4. Actions: the children (BulkAction buttons), 8px apart, wrap on narrow widths.

BulkAction: a pill button, 13px / 600, padding 6px 13px.

Variants

PropValueLookWhen to use
toneink (default)Ink pill, inverted textOver a page toolbar (Approvals)
softAccent-tint pill with an accent border, ink textInside a card, where ink would be too heavy
BulkAction kindplain (default)White pill, --line borderNeutral actions ("Message", "Export")
approveLime, olive textThe primary positive action ("Approve 2")
dangerObsidian 700 (ink in soft), inverted textDestructive actions ("Reject")

States

StateTrigger
Hiddencount={0} and persistent={false} (returns nothing)
Visible at 0persistent: shows "0 selected"; disable the actions yourself (disabled)
Selectedcount > 0: count, clear button when onClear is given
Action disabledBulkAction disabled: 45% opacity, default cursor
Focus-visiblebuttons get --focus-ring (--focus-ring-inverse on ink)
Touch (≤1024px)clear and action buttons get a 44px hit area

Types

Words: provider labels.prBulkBar (region, selected(n), clear).

BulkAction

PropTypeDefaultRequiredDescription
onClick() => voidyesThe action.
childrenReactNodeyesThe label ("Approve 2").
kind'approve' | 'danger' | 'plain''plain'noLook.
disabledbooleannonenoNot clickable.

Usage

import { PrBulkBar, BulkAction } from '@ergasti/bricks';

<PrBulkBar count={2} onClear={() => setSel(new Set())}>
  <BulkAction kind="danger" onClick={openReject}>Reject</BulkAction>
  <BulkAction kind="approve" onClick={approveSelected}>Approve 2</BulkAction>
</PrBulkBar>
// Approvals: the bar takes the toolbar's actions slot while rows are selected
<ListToolbar
  search={{ value: q, onChange: setQ, placeholder: 'Search creators' }}
  actions={sel.size > 0 ? (
    <PrBulkBar count={sel.size} onClear={() => setSel(new Set())}>
      <BulkAction kind="danger" onClick={() => setRejecting([...sel])}>Reject</BulkAction>
      <BulkAction kind="approve" onClick={() => approve([...sel])}>{`Approve ${sel.size}`}</BulkAction>
    </PrBulkBar>
  ) : <Segmented label="Scope" value={scope} onChange={setScope} options={[['mine', 'My brands'], ['all', 'All brands']]} />}
/>
<DataTable
  label="Join requests"
  rows={requests}
  columns={joinRequestColumns('en', { onApprove, onReject })}
  rowKey={(r) => r.id}
  selection={{ selected: sel, onChange: setSel, rowLabel: (r) => r.creator.name }}
/>
<ReasonDialog open={rejecting.length > 0} mode="select" title={`Reject ${rejecting.length} creators?`} confirmLabel="Reject"
  reasons={[{ value: 'fit', label: 'Not a fit for this brand' }, { value: 'other', label: 'Other' }]}
  onClose={() => setRejecting([])} onConfirm={({ reason, note }) => rejectAll(rejecting, reason, note)} />

Always shown. persistent keeps the bar drawn when nothing is selected (the count reads 0 and actions stay visible), for a page whose actions are always in reach. (docs example Persistent)

import { BulkAction, PrBulkBar } from '@ergasti/bricks';

export function Persistent() {
  return <PrBulkBar count={0} persistent tone="soft"><BulkAction onClick={() => {}}>Export all</BulkAction></PrBulkBar>;
}

Where it appears

  • PR Portal › Approvals › join requests toolbar ("2 selected · Reject · Approve 2").
  • Dashboard screen: PrApprovals.

Guidelines

Do

  • Put the count in the primary action's label ("Approve 2") so the scope is clear.
  • Order actions destructive first, primary last (the mock's Reject, Approve).
  • Route a destructive bulk action through ReasonDialog when the creator must be told why.

Don't

  • Don't show more than three actions; move the rest to the row.
  • Don't use persistent unless the layout would jump without it; then disable the actions at 0.
  • Don't use approve for a neutral action.

RTL and Arabic

The pill's padding uses padding-inline-start, so the count leads from the right in Arabic. Arabic words: "{n} متحدد", "الغي التحديد", region "إجراءات جماعية"; the count uses the language's digits from count().

Tokens

--ink, --color-text-inverted, --color-accent-border, --color-accent-tint, --lime, --olive, --color-obsidian-700, --line, --card, --focus-ring, --focus-ring-inverse, --min-touch-target.

Accessibility

  • A labelled region ("Bulk actions"); the count is aria-live="polite". The bar returns nothing at 0 (unless persistent), so the live region mounts together with the first count and screen readers often skip that first "1 selected"; later changes ("2 selected", "3 selected") are announced. Use persistent when the first selection must be heard.
  • The clear button has aria-label and title "Clear selection".
  • Real <button type="button">s; focus ring is the inverse ring on ink so it stays visible.
  • 44px touch targets at ≤1024px through a transparent ::before.

Found in the source

  • Roles in the markup: region.
  • ARIA attributes set: aria-label, aria-live.
  • Its tests cover: “hidden with nothing selected; a labelled region with the count announced”; “keyboard: actions and clear are buttons in order”.

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

  • BulkActionBar (kit): the brand dashboard's bulk bar.
  • ApprovalActions: per-row Reject / Approve.
  • ReasonDialog: the reason step after a bulk Reject.

See also: useLanguage · BulkAction · ChangePreview · ChoiceGroup · DecisionsCard

Source

src/pr/PrBulkBar.tsx (line 20) on GitHub.

On this page