Skip to content

Table selection: opt-in bulk-actions toolbar #5486

Closed

Description

@humbertovirtudes

TL;DR Add fixed and floating bulk-action recipes for controlled Table selection. Keep useTableSelection selection-only, compose Astryx Toolbar at the product callsite, and make the floating example scroll within a capped demo region.

Problem

useTableSelection exposes controlled row-selection state, but products still need a consistent way to present actions for the selected rows. Two layouts are required:

Variant Use case Behaviour
Fixed Standard tables where actions may move content Renders in flow above the table
Floating Long tables where actions must remain available while rows scroll Stays visible inside a capped, self-contained example scroll region

The EPS Table implementation proves both layouts are useful, but its toolbar is created by the selection plugin through a layout transform. That ownership model does not fit Astryx: action labels, destructive behaviour, selection scope, product copy, and surrounding layout belong to the product.

Architecture decision

useTableSelection remains responsible only for selection behaviour and row semantics.

  • Do not add a bulkActions option to UseTableSelectionConfig.
  • Do not add public bulk-action types or a Table-owned bulk-action component.
  • Do not inject toolbar chrome through transformScrollWrapper.
  • Compose the toolbar from controlled selectedKeys at the product callsite.
  • Use the existing Astryx Toolbar component for semantics, keyboard navigation, slot layout, size cascading, and the muted surface.

Functional requirements

Fixed variant

  • Render Toolbar in flow immediately above the table.
  • Render product actions in startContent.
  • Render the selected count and Unselect All in endContent.
  • Hide the toolbar when selectedKeys.size === 0.
  • Clearing selection removes the toolbar and restores the unselected table state.

Floating variant

  • Demonstrate a long non-sticky table with metric cards above it.
  • Cap the example height and keep vertical scrolling inside the example.
  • Keep the Toolbar outside Table's horizontal overflow wrapper.
  • Keep the toolbar visible while the example scrolls through table rows.
  • Release the toolbar at the table region boundary.
  • Reserve the toolbar space so selection changes do not move the table.
  • Hide the toolbar when selectedKeys.size === 0.

Accessibility

  • Name the action surface Bulk actions through Toolbar.label.
  • Preserve logical start/end ordering in LTR and RTL.
  • Keep every action keyboard reachable through Toolbar's existing roving-focus behaviour.
  • Keep selection count text and the clear action available without relying on colour.

Acceptance criteria

  • useTableSelection has no bulk-action API and contributes no wrapper chrome.
  • Both examples use Astryx Toolbar, not hand-built toolbar semantics.
  • Fixed actions appear at logical start; count and clear appear at logical end.
  • The floating demo has a capped height and self-contained vertical scrolling.
  • Selecting a row causes no table movement in the floating variant.
  • The floating toolbar remains visible while table rows scroll and releases with its region.
  • Storybook interaction coverage verifies selection, clear, Toolbar placement, and scrolling.
  • CLI template examples and docs match the Storybook recipes.
  • Typecheck, lint, Storybook build, docsite tests, and browser verification pass.

Outcome

Landed in #5489 on 30 September 2026 as merge commit d774400a9dec88cda93f537170a82d427622acac.

The final implementation keeps useTableSelection behaviour-only, exposes shared selection state through useTableSelectionState, and adds a reusable TableSelectionToolbar built on Astryx Toolbar. Product callsites continue to own actions, copy, and fixed versus floating placement. Fixed and floating Storybook, website, CLI-template, documentation, registry, accessibility, RTL, and browser coverage shipped with the change.

Non-goals

  • A shared bulk-action action model.
  • Cross-page selection semantics such as "select all matching".
  • A public Table bulk-action component.
  • Sticky Table headers or integration with the Table sticky-header stack.

PR: #5489

Metadata

Metadata

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions