Xzero UI
Pro library

Selection toolbarPro

A contextual batch action surface that appears when items are selected.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/selection-toolbar
Live · keyboard ready

Use it next to selectable collections. Keep the count accurate and confirm destructive actions before applying them.

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/selection-toolbar

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { SelectionToolbar } from "@/components/xzero/selection-toolbar/selection-toolbar";

export function ProjectsBar({ selected, clear }: { selected: string[]; clear: () => void }) {
  return (
    <SelectionToolbar
      count={selected.length}
      noun="project"
      onClear={clear}
      actions={[
        { label: "Archive", onClick: () => archive(selected) },
        { label: "Delete", onClick: () => remove(selected), destructive: true },
      ]}
    />
  );
}

API reference

SelectionToolbar

A floating bar that appears while items are selected, showing a rolling count, bulk actions, and a clear button.

PropTypeDefaultDescription
count (required)number–Number of selected items. The bar mounts above 0 and leaves at 0.
actions (required)SelectionAction[]–Bulk actions rendered as buttons after the count.
onClear (required)() => void–Called by the clear button. Reset your selection here.
nounstring"item"Singular noun; an s is added when count is not 1.

SelectionAction

Action type: { label: string; icon?: ReactNode; onClick: () => void; destructive?: boolean }. label is also the React key, so keep labels unique.

No props.

Keyboard interactions

KeysAction
TabMoves through the actions and the clear button.
Enter / SpaceActivates the focused button.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Guidance for AI tools

Blocks are complete, self-contained screens with sample data. Replace the sample data and connect the callbacks described above. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components