FloatingActionBar

FloatingActionBar help users perform an action from a list.

View source code

Usage

A FloatingActionButton should be used when a user wants to perform an action that applies to multiple items, such as in a Table or a ListBox component.

Account payableSupplier nameAmount
401AIRBNBAirbnb2€
401DELOITTEDeloitte324$
401MAILCHIMPMailchimp13.29€
401APPLEApple0€
{selectedRowIds.length > 0 && (
  <FloatingActionBar
    actions={[
      {
        text: "Archive",
        onClick: handleArchive,
        iconName: "archive",
      },
      {
        text: "Download",
        onClick: handleDownload,
        iconName: "arrow-down-tray",
      },
    ]}
  >
    {`${selectedRowIds.length} selected`}
  </FloatingActionBar>
)}
<Table
  data={data}
  columns={columns}
  getRowId={(row: DataRow) => String(row.id)}
  selectedRowIds={selectedRowIds}
  onRowSelectionChange={handleRowSelection}
  onAllRowsSelectionChange={handleAllRowsSelection}
/>

ActionBar

If you don't require the floating behavior of the FloatingActionButton, you can use the ActionBar component instead. The ActionBar component has the same props as the FloatingActionButton.

<ActionBar
  actions={[
    {
      text: "Archive",
      onClick: () => "Archive",
      iconName: "archive",
    },
    {
      text: "Edit",
      onClick: () => "Edit",
      iconName: "pen",
    },
    {
      text: "Download",
      onClick: () => "Download",
      iconName: "arrow-down-tray",
    },
  ]}
>
  3 selected
</ActionBar>