Action Bar
NewFloating bar that rises when items are selected: the count, bulk actions and clear. Escape clears.
1 selected
Installation
$ pnpm dlx shadcn@latest add @synccn/action-barFirst time in this project? Connect synccn with one command.
Usage
import { ActionBar } from "@/components/ui/action-bar";<ActionBar count={selected.length} onClear={clear}>…</ActionBar>API reference
Generated from the component's TypeScript types, so it always matches the code.
ActionBar
Floating bar that rises from the bottom when items are selected: the count, bulk actions and a clear button. Escape clears. The count is announced to screen readers.
- countrequired
numberItems selected. The bar shows while this is above 0.
- children
React.ReactNodeButtons for what to do with the selection.
- onClearrequired
() => voidClears the selection. Also runs on Escape.
- label
stringDefault
"selected"Noun after the count.
- position
"fixed" | "absolute"Default
"fixed""fixed" sits at the bottom of the window; "absolute" at the bottom of the nearest positioned parent.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for X
Keyboard
- EscClear the selection
Accessibility
- The bar is a toolbar, and the selection count is announced as it changes.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA roles: toolbar
- ARIA attributes: aria-label, aria-live
- Keys handled: Escape
- Includes text only screen readers hear
- Announces changes to screen readers