@molecule/app-bulk-action-toolbar-solid

Feature · bulk-action-toolbar · App (browser) · v1.1.2 · Apache-2.0

Selection-aware floating toolbar that appears when N rows are selected

npm install @molecule/app-bulk-action-toolbar-solid

npm · Source on GitHub

How it works

@molecule/app-bulk-action-toolbar-solid is a ready-made bulk-action-toolbar feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.

import { BulkActionToolbar } from '@molecule/app-bulk-action-toolbar-solid'

;<BulkActionToolbar
  count={selectedIds().length}
  actions={[
    {
      id: 'delete',
      label: 'Delete',
      onClick: () => handleDelete(selectedIds()),
      destructive: true,
    },
    { id: 'export', label: 'Export', onClick: () => handleExport(selectedIds()) },
  ]}
  onClearSelection={() => setSelectedIds([])}
/>

Works with: @molecule/app-solid, @molecule/app-ui, @molecule/app-ui-solid

Reference

Solid selection-aware bulk action toolbar.

Exports BulkActionToolbar and the BulkAction type — the Solid counterpart of @molecule/app-bulk-action-toolbar-react: the same props (React names) and the same DOM for the same input.

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Quick Start

import { BulkActionToolbar } from '@molecule/app-bulk-action-toolbar-solid'

;<BulkActionToolbar
  count={selectedIds().length}
  actions={[
    {
      id: 'delete',
      label: 'Delete',
      onClick: () => handleDelete(selectedIds()),
      destructive: true,
    },
    { id: 'export', label: 'Export', onClick: () => handleExport(selectedIds()) },
  ]}
  onClearSelection={() => setSelectedIds([])}
/>

Type

feature

Installation

npm install @molecule/app-bulk-action-toolbar-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js

API

Interfaces

BulkAction

Descriptor for a single action button rendered inside BulkActionToolbar.

interface BulkAction {
  /** Stable id — the render key of the action's button. */
  id: string
  /** Button label. */
  label: JSX.Element
  /** Optional leading icon inside the button. */
  icon?: JSX.Element
  /** Called when the action's button is clicked. */
  onClick: () => void
  /** Renders the button as a solid error-colored (destructive) button. */
  destructive?: boolean
  /** Disables the button. */
  disabled?: boolean
}

BulkActionToolbarProps

Props accepted by the BulkActionToolbar component.

interface BulkActionToolbarProps {
  /** Selection count — toolbar hides when 0. */
  count: number
  /** Action buttons. */
  actions: BulkAction[]
  /** Called when "Clear selection" is clicked. */
  onClearSelection?: () => void
  /** Position — `'sticky-bottom'` (default), `'sticky-top'`, or `'inline'`. */
  position?: 'sticky-bottom' | 'sticky-top' | 'inline'
  /** Extra classes. */
  className?: string
}

Functions

BulkActionToolbar(props)

Selection-aware bulk action bar — appears when the user has selected one or more rows, shows the count + a row of action buttons + a "Clear selection" link.

Renders nothing while count <= 0 (<Show> renders no element, the way React's component returns null). position defaults to 'sticky-bottom' (16px inset, z-30); 'sticky-top' and 'inline' are also supported. Destructive actions render as solid error-colored buttons.

React keys each action button by the action's id, so a re-ordered or re-passed array moves/keeps the rendered buttons per key. Solid's For keys by reference, so the buttons are keyed through stable per-id records: the record for an id is created once and reused (a re-pass or reversal moves/keeps the rendered button, like React), while the button reads the CURRENT action for its id reactively (a changed label updates in place).

This is the Solid counterpart of @molecule/app-bulk-action-toolbar-react: the same props (React names), the same ClassMap tokens, and the same DOM for the same input.

function BulkActionToolbar(props: BulkActionToolbarProps): JSX.Element
  • props — Component props (see BulkActionToolbarProps).

Returns: The rendered toolbar.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-solid ^3.5.0 || ^4.0.0
  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-solid ^1.1.0
  • solid-js ^1.8.0

Runtime Dependencies

  • @molecule/app-solid
  • @molecule/app-ui
  • @molecule/app-ui-solid
  • solid-js

Renders nothing while count <= 0 — mount it unconditionally and drive it from selection state. position defaults to 'sticky-bottom' (16px inset, z-30); 'sticky-top' and 'inline' are also supported. Destructive actions render as solid error-colored buttons. The count label, the Clear button and the toolbar's own aria-label are translated via useTranslation() (React's exact keys and default values) and the companion @molecule/app-locales-bulk-action-toolbar locale bond. An action's node-valued fields (label, icon) are Solid JSX values.

Translations

Translation strings are provided by @molecule/app-locales-bulk-action-toolbar.