Installation
npx sdaia-ui@latest add table-bulk-actions-bar
Usage
import { TableBulkActionsBar } from '@/components/ui/TableBulkActionsBar';<TableBulkActionsBar
selectedCount={selected.length}
totalCount={rows.length}
onSelectAllChange={(all) => setSelected(all ? rows.map((r) => r.id) : [])}
onClearSelection={() => setSelected([])}
onClose={() => setSelected([])}
actions={<Button size="sm">Export</Button>}
/>
<Table selectable selectedRowKeys={selected} onSelectionChange={setSelected} … />RTL
Everything mirrors for right-to-left.
Loading demo: table-bulk-actions-bar-rtl
Examples
Inline
Sits above the table header. Clear the selection to hide it.
Loading demo: table-bulk-actions-bar-default
With a table
Wired to the Table's row selection; the bar replaces the table toolbar while rows are selected.
Loading demo: table-bulk-actions-bar-with-table
Floating
Sticks to the bottom while a long table scrolls, and settles after the table so it never covers the pagination.
Loading demo: table-bulk-actions-bar-floating
Fewer actions
Without the clear link and with a single action.
Loading demo: table-bulk-actions-bar-fewer-actions
When to use
- Tables where users act on several rows at once
- Approving, exporting or deleting a selection
- Showing how many rows are selected
- Letting users clear the selection quickly
When not to use
- Actions for a single row — use row actions
- Tables without row selection
- More than three bulk actions — use a menu
- Permanent actions without a confirmation step
Props
Prop | Type | Default | Required |
|---|---|---|---|
selectedCount | number | — | optional |
totalCount | number | — | optional |
onSelectAllChange | (checked: boolean) => void | — | optional |
onClearSelection | () => void | — | optional |
onClose | () => void | — | optional |
actions | ReactNode | — | optional |
position | "inline" | "floating" | "inline" | optional |
returnFocusRef | RefObject<HTMLElement> | next focusable | optional |
labels | Partial<TableBulkActionsBarLabels> | English | optional |
dir | "ltr" | "rtl" | inherited | optional |
Accessibility
- The bar is a role="region" landmark named "Bulk actions" (labels.region).
- The selected count is announced politely (aria-live="polite") as it changes.
- The select-all checkbox is indeterminate (aria-checked="mixed") while only some rows are selected.
- "Clear selection" is a button with link styling, because it acts rather than navigates. When the bar hides while it holds focus, focus moves on to the next control (or returnFocusRef) instead of being lost.
- Destructive actions must ask for confirmation.
Responsive behavior
- The bar wraps: when the space inside it (its width minus its padding and border) is under 36rem, the actions move to their own row under the count and close button.
- The floating bar is capped at 760px and centred; it uses position: sticky, 24px above the viewport bottom.
- Spacing and type use the responsive tokens.