Skip to content

Bulk Actions

Data and metricsMIT
View in Storybook

Floating action bar that appears when rows are selected, with configurable actions.

bun add @otfdashkit/ui

Preview

Bulk Actions

Code

import React from 'react'
import { Trash2, Download, Archive } from 'lucide-react'
import { BulkActions } from '@otfdashkit/ui'

function BulkActionsDemo() {
  const [count, setCount] = React.useState(3)
  return (
    <div className="relative h-24 flex items-center justify-center">
      <button className="text-sm underline" onClick={() => setCount((c) => (c === 0 ? 3 : 0))}>Toggle selection ({count} selected)</button>
      <BulkActions
        count={count}
        onClear={() => setCount(0)}
        actions={[
          { label: 'Archive', icon: <Archive className="h-3.5 w-3.5" />, onClick: () => {} },
          { label: 'Download', icon: <Download className="h-3.5 w-3.5" />, onClick: () => {} },
          { label: 'Delete', icon: <Trash2 className="h-3.5 w-3.5" />, onClick: () => {}, variant: 'destructive' },
        ]}
      />
    </div>
  )
}

export function Example() {
  return (
    <BulkActionsDemo />
  )
}

Free with the SDK. This block ships in @otfdashkit/ui under the MIT license.

Props

Props declared in the BulkActions source. Inherited HTML attributes are not listed.

PropTypeDefaultDescription
actionsrequiredActionDef[]
countrequirednumber
onClearrequired() => void
classNamestring