RowActions
A table row's actions, compact: up to maxVisible small buttons (primary, secondary, danger), the rest in a "⋯" menu (arrow keys, Home / End, Escape back to the button). An action can be busy (spinner, focus kept) or disabled with a reason (aria-disabled, so it stays focusable and its reason is read). Danger actions confirm first. Clicks, Enter and Space never reach the row; Tab and an Escape the actions did not use do (a dialog's trap still works).
import { RowActions } from '@ergasti/bricks';Examples
Row actions
Up to maxVisible actions as buttons and the rest in a "…" menu. Presets (approve, reject, resend, copyLink, cancelInvite) bring their words and tone; confirm asks before a risky action; busy and disabledReason explain themselves.
Code
import { RowActions, invitationActions, joinRequestActions } from '@ergasti/bricks';
function Presets() {
return (
<div style={{ display: 'grid', gap: 16 }}>
<RowActions label="Karim Hosny" actions={joinRequestActions({ onApprove: () => {}, onReject: () => {} })} />
<RowActions label="Rana Mostafa" actions={invitationActions({ onResend: () => {}, onCopyLink: () => {}, onCancel: () => {} })} maxVisible={1} />
<RowActions label="Dina Khaled" actions={invitationActions({ onResend: () => {}, onCancel: () => {}, resendDisabledReason: 'Resent less than a minute ago' })} />
</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 rowActions, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
more | More actions | إجراءات تانية |
working | Working… | شغالين… |
sure | Sure? {label} | متأكد؟ {label} |
approve | Approve | وافق |
reject | Reject | ارفض |
resend | Resend | ابعتها تاني |
copyLink | Copy link | انسخ اللينك |
cancelInvite | Cancel invite | الغي الدعوة |
Design guidance
How the BRICKS design system uses RowActions. Written in docs/content/components/RowActions.md; the props above are read from the code, which wins where the two disagree.
A table row's compact action buttons: up to maxVisible small buttons, the rest in a "⋯" menu, with busy, disabled-with-reason and confirm-first states; use it in the last column of a row that needs more than a chevron.
The v3 mocks have no per-row buttons for invitations or join requests (they show only "With TRNDR"); the library adds this block for the real app's pending invitations and join requests, with two presets: joinRequestActions (Approve, Reject) and invitationActions (Resend, Copy link, Cancel invite). Clicks, Enter and Space inside it never reach the row, so it is safe in a clickable DataTable or RowList row.
Anatomy
- Group (
.kit-blk-ra,role="group", named bylabel): inline-flex, gap 6, wraps. - Inline buttons (
.kit-blk-ra-b): small kit buttons; tone ink (primary), outlined (secondary) or red words (danger). A busy one shows a 12px spinner before its words. - Reason (screen-reader text, also the hover
title) for a disabled action. - "⋯" button (
.kit-blk-ra-dots, ghost, 34px wide; 44px on touch tiers ≤1024px): only when there are more actions thanmaxVisible. - Menu (
.kit-blk-ra-menu,role="menu"): fixed under the "⋯" button, end-aligned, 180–280px, radius 14, shadow; items (.kit-blk-ra-mi) with the disabled reason under them in 11px.
Variants
RowAction.tone | Look | Use when |
|---|---|---|
'primary' | Ink-filled small button (kit-btn--ink) | The expected action (Approve). One per row. |
'secondary' (default) | Outlined small button | Neutral actions (Resend, Copy link). |
'danger' | Red words; confirms first ("Sure? Cancel invite") | Destructive actions. In the menu: red item. |
Preset (RowAction.preset) | English | Arabic |
|---|---|---|
approve | Approve | وافق |
reject | Reject | ارفض |
resend | Resend | ابعتها تاني |
copyLink | Copy link | انسخ اللينك |
cancelInvite | Cancel invite | الغي الدعوة |
maxVisible (default 2) sets how many stay inline; with more actions than that, the rest move to the "⋯" menu.
States
| State | How | Behaviour |
|---|---|---|
| Default | — | Buttons run onSelect on click. |
| Focus-visible | keyboard | Kit focus ring on buttons; inset ring on menu items. |
| Busy | busy: true | Spinner + "Working…" (screen readers), aria-busy, clicks ignored, focus kept. |
| Disabled with reason | disabledReason: 'No seats left: raise your limit first' | aria-disabled (stays focusable), 50% opacity, reason as title and aria-describedby; in the menu, the reason under the item. '' disables without words (presets use it for the other action while one is busy). |
| Armed (confirm) | confirm: true (default for danger) or a string | First press turns the button raspberry with "Sure? Cancel invite" (or your string); second press runs. Escape or blur disarms. Announced once in a role="status". |
| Overflow open | "⋯" click or ArrowDown | Menu opens, first item focused; follows the button on scroll/resize, closes when the button scrolls off screen. |
Types
RowAction: id (required), label? (else the preset's words), preset?, tone? ('primary' | 'secondary' | 'danger', default 'secondary'), onSelect (required), busy?, disabledReason?: string | null, confirm?: boolean | string.
Presets:
joinRequestActions({ onApprove, onReject, busy?: 'approve' | 'reject' | null, approveDisabledReason? }): Approve (primary) and Reject (danger,confirm: false: the app's reason dialog is the confirm).invitationActions({ onResend, onCopyLink?, onCancel, busy?: 'resend' | 'copyLink' | 'cancel' | null, resendDisabledReason? }): Resend, Copy link (only withonCopyLink), Cancel invite (danger, confirmed).
RowActionsCopy (labels): more, working, sure(label), and the five preset words (approve, reject, resend, copyLink, cancelInvite).
Usage
import { RowActions, joinRequestActions, type DataColumn } from '@ergasti/bricks';
type JoinRequest = { id: number; creator: { name: string } };
declare const pending: Record<number, 'approve' | 'reject' | null>;
declare const seatsLeft: number;
declare function approve(id: number): void;
declare function openRejectDialog(id: number): void;
// Join requests: the last column of a DataTable
const actionsColumn: DataColumn<JoinRequest> = {
key: 'actions', label: '', align: 'end',
render: (r) => (
<RowActions
label={`Actions for ${r.creator.name}`}
actions={joinRequestActions({
onApprove: () => approve(r.id),
onReject: () => openRejectDialog(r.id),
busy: pending[r.id] ?? null,
approveDisabledReason: seatsLeft === 0 ? 'No seats left: raise your limit first' : null,
})}
/>
),
};// Pending invitations: three actions, one inline, the rest in "⋯" on narrow rows
<RowActions
label={`Actions for ${invite.name}`}
maxVisible={isPhone ? 1 : 3}
actions={invitationActions({
onResend: () => resend(invite.id),
onCopyLink: () => copy(invite.link),
onCancel: () => cancel(invite.id),
resendDisabledReason: invite.resentToday ? 'Resent today: you can resend tomorrow' : null,
})}
/>// Your own actions
<RowActions
label="Actions for Winter glow launch"
actions={[
{ id: 'edit', label: 'Edit', onSelect: edit },
{ id: 'end', label: 'End now', tone: 'danger', confirm: 'Sure? End the challenge', onSelect: endNow },
]}
/>Where it appears
- Not drawn in the v3 mocks (the INVENTORY lists it as a library addition for invitation and join-request rows).
- Shown in the library's gallery (
gallery/MissingBrandGallery.tsx): Brand › Creators › Join requests and Pending invitations lists. - The PR Portal's approvals use their own round buttons (
ApprovalActions,ApprovalRow).
Guidelines
Do
- Name the group after the row ("Actions for Salma Hosny") so every row's identical button words are distinguishable.
- Keep one primary action per row, and put it first.
- Say why an action is unavailable with
disabledReasoninstead of hiding it.
Don't
- Don't set
confirmon an action that already opens a dialog (the preset's Reject does not). - Don't put more than 2–3 inline buttons in a table; let the rest overflow.
- Don't use native
disabled: the component usesaria-disabledso the reason can be read.
RTL and Arabic
- Buttons flow from the start side; the menu aligns its end edge to the "⋯" button's end edge, using the left edge in RTL.
- Arabic words for presets, "إجراءات تانية" (More actions), "شغالين…" (Working…), "متأكد؟ …" (Sure? …).
Tokens
--card, --line, --soft (item hover), --ink, --ink-3 (reason, disabled item), --bad (danger item), --rasp (armed item), --focus-ring-inset, --min-touch-target; plus kit button tokens.
Accessibility
role="group"witharia-label; buttons are real<button type="button">.- Disabled =
aria-disabled+aria-describedbyreason, still focusable; busy =aria-busy+ "Working…" text. - "⋯" has
aria-label="More actions",aria-haspopup="menu",aria-expanded,aria-controls. Menu:role="menu"ofrole="menuitem"; ArrowUp/Down wrap, Home/End, Escape returns focus to "⋯", Tab closes. - Armed words are announced once through a
role="status"region; focus stays on the button. - Event containment: clicks, Enter and Space stop at the group; Tab and unused Escape continue, so dialogs' focus traps still work.
Found in the source
- Roles in the markup:
menuitem,group,status,menu. - ARIA attributes set:
aria-hidden,aria-label,aria-disabled,aria-busy,aria-describedby,aria-haspopup,aria-expanded,aria-controls. - Keys the code handles: Enter, Space, Escape, ArrowDown, ArrowUp, Home, End, Tab.
- It moves focus in code.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
ApprovalActions: the PR Portal's round Reject / Approve pair.BulkAction/PrBulkBar: the same actions for many selected rows.Menu/TopbarMenu: a general menu not tied to a row.
See also: useLanguage
Source
src/blocks/rowactions/RowActions.tsx (line 133) on GitHub.