A Bootstrap 6 member list with a "Select all" checkbox that turns indeterminate when only some rows are checked. It has a live "2 of 5 selected" counter, Shift+click range selection and bulk action buttons that stay disabled until something is selected. It fits user tables, inbox lists, file managers and any admin screen with bulk actions.
How it works
The toolbar holds the master checkbox (.csa-all .check), the counter (.csa-count) and two buttons with data-csa-action. Each .csa-row in #csa-list contains an <input class="check csa-item">, a <label class="csa-person"> with an initials .avatar, and a role badge. The whole name area is clickable.
script.js collects every .csa-item that is not disabled. The owner row stays out of bulk selection. After any change, sync():
- sets the master box to
checkedwhen all rows are selected; - sets it to
indeterminatewhen only some are selected; - updates
.csa-count-numand.csa-count-max; - disables the action buttons when nothing is selected.
Toggling the master box applies its state to every row. With Shift+click, all rows between the last clicked item and the current one get the same state. The action buttons collect the selected names and print a simulated result in .csa-status.
Selected rows get a green tint and a left accent bar from the CSS rule .csa-row:has(.csa-item:checked), with no extra JavaScript.
Customization
--csa-brandand--csa-brand-softon.csa-root: recolor checked boxes, the selected-row tint, the counter and the primary button..csa-avatar--ato.csa-avatar--f: set the background of each initials avatar, or replace the letters with an<img class="avatar-img">.- Add
disabledto any.csa-itemto lock that row out of "Select all", as the owner row is. data-csa-actionon a button: add actions such asarchive, and handle them in the action click listener.- Replace the status messages in that listener with a
fetch()call that sends the selected IDs. - The
max-width: 575.98pxrule hides.csa-rolebadges and makes the action buttons full width on phones.
Use cases
- User and member tables: a select-all box turns indeterminate when only some rows are checked
- Inbox and message lists: Shift+click selects a range of rows at once
- File managers: bulk action buttons stay disabled until at least one item is selected
- Admin screens: a live counter shows how many items are selected, with the owner row excluded
Accessibility
Every checkbox has its own <label for>. The master box points to the list with aria-controls. Native checkboxes announce the mixed state on their own. The counter is aria-live="polite", and .csa-status has role="status", so selections and results are spoken. Avatars are aria-hidden because the name is already in the label. Row highlight transitions stop under prefers-reduced-motion.
Bootstrap 6 notes
Bootstrap 5's form-check-input becomes a plain .check. Its indeterminate dash is built in and uses the --bs-check-icon-indeterminate mask. Colors come from --bs-control-checked-bg, not theme-* on the input. Buttons use btn-subtle theme-secondary and btn-solid theme-success, and badges use badge-subtle / badge-outline. The initials circles use the new .avatar component. Built on Bootstrap 6.0.0-alpha.1. Alpha APIs can still change.