BulkAction
A bulk bar button: approve (lime on ink, the mock's "Approve N"), danger (the dark "Reject"), plain.
import { BulkAction } 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
Design guidance
How the BRICKS design system uses BulkAction. Written in docs/content/components/BulkAction.md; the props above are read from the code, which wins where the two disagree.
A pill button for the PR bulk bar: lime "Approve N", dark "Reject" or a plain white action; use it as a child of PrBulkBar while table rows are selected.
It is the PR mock's .bulk buttons (Reject, then a lime "Approve N"). PrBulkBar shows "N selected" in an aria-live span, an optional clear "×", and these actions on an ink pill (or a light bar with tone="soft").
Anatomy
- Button (
.kit-pr-bulk-btn): 6px × 13px, fully round, 13px 600, no wrap. On touch tiers (≤1024px) a transparent::beforegives it a 44px hit area; on desktop it is its drawn size (about 30px tall).
Variants
kind | Look | Use when |
|---|---|---|
'approve' | Lime fill, olive text | The positive bulk action ("Approve 3"). |
'danger' | Obsidian fill, white text (ink on a soft bar) | "Reject". |
'plain' (default) | White with a border | Neutral ("Export", "Assign owner"). |
States
| State | How |
|---|---|
| Disabled | disabled: 45% opacity. On the ink bar a disabled plain or danger button falls well below 4.5:1 and reads as missing; show a disabled action only on the soft bar (tone="soft"), or leave the action out and say why near the table. The preview shows it on the soft bar for that reason. |
| Focus | Inverse focus ring on the ink bar. |
Usage
import { useState } from 'react';
import { BulkAction, PrBulkBar } from '@ergasti/bricks';
export function ApprovalsBulk({ approveMany, rejectMany }: { approveMany: (ids: number[]) => void; rejectMany: (ids: number[]) => void }) {
const [selected, setSelected] = useState<number[]>([12, 15, 18]);
return (
<PrBulkBar count={selected.length} onClear={() => setSelected([])}>
<BulkAction kind="danger" onClick={() => rejectMany(selected)}>Reject</BulkAction>
<BulkAction kind="approve" onClick={() => approveMany(selected)}>Approve {selected.length}</BulkAction>
</PrBulkBar>
);
}Where it appears
- PR Portal › Approvals › the bulk bar over the join requests table. Screen: PR · Approvals,
PrBulkBar.
Guidelines
Do
- Put the count in the approve words ("Approve 3").
- Keep the mock's order: Reject, then "Approve N" last (as
ApprovalActionsdoes per row). Keep two or three actions.
Don't
- Don't use it outside
PrBulkBar. - Don't confirm destructive bulk actions silently; open a
ReasonDialogfor Reject.
RTL and Arabic
- Buttons flow right to left in the bar.
Tokens
--lime, --olive, --color-obsidian-700, --color-text-inverted, --card, --line, --ink, --focus-ring-inverse, --min-touch-target.
Accessibility
- A real
<button type="button">with visible words; the bar is a labelled region whose count isaria-live. The bar returns nothing at 0 (unlesspersistent), so the live region mounts with the first count and that first "1 selected" is often not announced; later changes are. Passpersistentto keep the region mounted.
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.
Related
PrBulkBar: its container.ApprovalActions: per-row actions.BulkBar(kit): the brand dashboard's bulk bar.
See also: useLanguage · ChangePreview · ChoiceGroup · DecisionsCard · FigureRow
Source
src/pr/PrBulkBar.tsx (line 42) on GitHub.