@molecule/app-bulk-action-toolbar-svelte
Feature · bulk-action-toolbar · App (browser) · v1.1.4 · Apache-2.0
Selection-aware floating toolbar that appears when N rows are selected
npm install @molecule/app-bulk-action-toolbar-svelteHow it works
@molecule/app-bulk-action-toolbar-svelte 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.
<script lang="ts">
import { BulkActionToolbar } from '@molecule/app-bulk-action-toolbar-svelte'
let selectedIds = $state<string[]>([])
</script>
<BulkActionToolbar
count={selectedIds.length}
actions={[
{ id: 'delete', label: 'Delete', onClick: () => handleDelete(selectedIds), destructive: true },
{ id: 'export', label: 'Export', onClick: () => handleExport(selectedIds) },
]}
onClearSelection={() => (selectedIds = [])}
/>Works with: @molecule/app-svelte, @molecule/app-ui, @molecule/app-ui-svelte
Reference
Svelte selection-aware bulk action toolbar.
Exports BulkActionToolbar and the BulkAction type — the Svelte
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.tsJSDoc, not this file.
Quick Start
<script lang="ts">
import { BulkActionToolbar } from '@molecule/app-bulk-action-toolbar-svelte'
let selectedIds = $state<string[]>([])
</script>
<BulkActionToolbar
count={selectedIds.length}
actions={[
{ id: 'delete', label: 'Delete', onClick: () => handleDelete(selectedIds), destructive: true },
{ id: 'export', label: 'Export', onClick: () => handleExport(selectedIds) },
]}
onClearSelection={() => (selectedIds = [])}
/>
Type
feature
Installation
npm install @molecule/app-bulk-action-toolbar-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte
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 — text or a snippet. */
label: Snippet | string
/** Optional leading icon inside the button. */
icon?: Snippet | string
/** 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
}
Constants
BulkActionToolbar
const BulkActionToolbar: LegacyComponentType
Injection Notes
Requirements
Peer dependencies:
@molecule/app-svelte^3.5.0 || ^4.0.0@molecule/app-ui^1.0.1@molecule/app-ui-svelte^1.6.0svelte^5.0.0
Runtime Dependencies
@molecule/app-svelte@molecule/app-ui@molecule/app-ui-sveltesvelte
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 snippets or strings.
Translations
Translation strings are provided by @molecule/app-locales-bulk-action-toolbar.