Skip to content
synccn

Action Bar

New

Floating 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-bar

First 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
    number

    Items selected. The bar shows while this is above 0.

  • children
    React.ReactNode

    Buttons for what to do with the selection.

  • onClearrequired
    () => void

    Clears the selection. Also runs on Escape.

  • label
    string

    Default "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
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

npm packages

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