Dashral Pro is hereSee pricing

Dashral

Action BarNew

The bar that rises while rows are selected: the count, actions for them, and a way to clear.

$ pnpm dlx shadcn@latest add @dashral/action-bar
InvoiceCustomerAmount
INV-1048Fernpay$1,240.00
INV-1047Cartwell$860.00
INV-1046Pagewell$420.00
INV-1045Driftbox$2,180.00

Installation

$ pnpm dlx shadcn@latest add @dashral/action-bar

Adds the component, the components it builds on, its npm packages and the theme tokens it uses. Or by its full URL: https://dashral.com/r/action-bar.json

Usage

example.tsx
import { Button } from "@/components/dashral/button"
import { ActionBar } from "@/components/dashral/action-bar"

<ActionBar
  open={selected.length > 0}
  count={selected.length}
  onClear={() => setSelected([])}
  actions={<Button variant="ghost" size="sm" onClick={() => archive(selected)}>Archive</Button>}
/>

Using the npm package? Import from @dashral/ui/components/action-bar instead, here and in the examples; the rest is the same.

Examples

In a card

position="inline" keeps it in the page's flow; label puts the count in your words.

API reference

ActionBar

Also takes every prop of <div>(opens in a new tab).

PropTypeDefault
openboolean

Whether it shows: usually while something is selected. Required.

—
countnumber

How many are selected: "3 selected", in the locale's plural.

—
labelReactNode

In place of "3 selected".

—
actionsReactNode

The buttons for the selection. Required.

—
onClear() => void

Shows an × that clears the selection; Escape inside the bar calls it too.

—
position"fixed" | "inline"

Floating at the bottom of the window, centred; or in the page's flow.

"fixed"
aria-labelstring

Names the toolbar.

"Actions for the selection"
classNames{ label, actions }

Classes for each part.

—
classNamestring

Extra classes, merged with cn() so yours win.

—

Keyboard

KeysAction
TabInto the bar's actions
EscapeClear the selection (with onClear)

Accessibility

  • role="toolbar", named "Actions for the selection" (translated); the count is a live region, announced as it changes.
  • While closed it's inert: hidden from screen readers, out of the tab order, not clickable.
  • On a phone, give the action buttons an icon and an sr-only label so the bar stays one row.

Motion

  • Rises 16px and fades in on the spring (--duration-considered); leaves faster on --ease-exit. It keeps the last count while it leaves. With reduced motion it only fades.