Selection Toolbar

Bulk-action toolbar for multi-select workflows.

Overview

SelectionToolbar surfaces bulk actions for selected rows or items. It renders as a floating contextual surface and composes Cubitt Button, Menu, and Popover parts for actions.

Usage

import {
  SelectionToolbar,
  type SelectionAction,
} from "@tilt-legal/cubitt-components/selection-toolbar";

Examples

Basic

A floating toolbar with direct actions, confirmation, success, and clear selection behavior.

Button Actions

Actions can be disabled while still remaining in the toolbar layout.

Use a dropdown action when selected items share several related bulk actions.

Custom Text

Override the selection copy when the toolbar needs to summarize selected data.

Popover Action

Popover actions can render custom controls while still reporting processing, success, and error states through the toolbar.

API Reference

SelectionToolbar

PropTypeDefaultDescription
selectedCountnumber-Number of selected items.
totalCountnumber-Total number of items in the selectable set.
actionsSelectionAction[]-Actions rendered after the selection summary.
onClear() => void-Called when the clear selection button is activated.
isVisiblebooleanselectedCount > 0Controls toolbar visibility.
selectionTextstring"{selectedCount} of {totalCount} selected"Custom summary text.
position"container" | "viewport""viewport"Positions the toolbar relative to its parent or the browser viewport.
variant"default" | "destructive" | "success""default"Visual state for the toolbar surface.
size"sm" | "md" | "lg""md"Controls toolbar segment and action button sizing.
successDurationnumber2000Milliseconds to show success or error feedback.
childrenReactNode-Additional content rendered beside the selection summary.
classNamestring-Additional classes for the toolbar root.

SelectionAction

PropTypeDescription
idstringStable action identifier.
labelstringVisible action label.
type"button" | "dropdown" | "popover"Action presentation. Defaults to a direct button.
iconElementTypeOptional icon component.
onClick() => void | Promise<void>Handler for button actions.
variantButton variantVisual style for the action trigger. Defaults to ghost.
disabledbooleanDisables the action.
successMessagestringMessage shown after a successful action.
confirmationMessagestringMessage shown before executing the action.
confirmTextstringConfirmation button text.
cancelTextstringCancel button text.
iconPropsobjectAdditional icon props.
itemsSelectionDropdownItem[]Dropdown items for type="dropdown".
popoverContentReactNode | (helpers) => ReactNodePopover content for type="popover".
popoverPropsobjectAlignment, side, offset, and class options for popover content.

SelectionDropdownItem

PropTypeDescription
idstringStable item identifier.
labelstringVisible item label.
iconElementTypeOptional icon component.
onClick() => void | Promise<void>Item action handler.
disabledbooleanDisables the item.
destructivebooleanStyles the item as destructive.
successMessagestringMessage shown after a successful item action.
confirmationMessagestringMessage shown before executing the item action.
confirmTextstringConfirmation button text.
cancelTextstringCancel button text.
iconPropsobjectAdditional icon props.

On this page