Skip to content

shadcn.io is not affiliated with official shadcn/ui

Shadcn Action Bar for React Radix UI

Display an action bar for selected items.

Framework
UI library

Radix UI does not include this primitive, so this page uses the Ark UI component. The visuals match the Ark UI version.

Installation

bunx --bun shadcn@latest add https://kit.dev/r/radix/action-bar.json

Anatomy

Action Bar anatomy: content, value, body, separator, close

Usage

import {
  ArchiveIcon,
  DownloadIcon,
  PencilIcon,
  Trash2Icon,
  XIcon,
} from "lucide-react";
import {
  ActionBar,
  ActionBarBody,
  ActionBarClose,
  ActionBarContent,
  ActionBarSeparator,
  ActionBarTrigger,
  ActionBarValue,
} from "@/components/ui/action-bar";
import { Button } from "@/components/ui/button";
<ActionBar>
  <ActionBarTrigger asChild>
    <Button variant="outline">Open</Button>
  </ActionBarTrigger>
  <ActionBarContent aria-label="Bulk actions">
    <ActionBarValue count={3} />
    <ActionBarSeparator />
    <ActionBarBody>
      <Button variant="ghost">
        <PencilIcon />
        <span className="max-sm:sr-only">Edit</span>
      </Button>
      <Button variant="ghost">
        <DownloadIcon />
        <span className="max-sm:sr-only">Export</span>
      </Button>
      <Button variant="ghost">
        <ArchiveIcon />
        <span className="max-sm:sr-only">Archive</span>
      </Button>
      <ActionBarSeparator />
      <Button variant="destructive">
        <Trash2Icon />
        <span className="max-sm:sr-only">Delete</span>
      </Button>
    </ActionBarBody>
    <ActionBarSeparator />
    <ActionBarClose asChild>
      <Button size="icon-md" variant="ghost">
        <XIcon />
      </Button>
    </ActionBarClose>
  </ActionBarContent>
</ActionBar>

Accessibility

KeyDescription
Enter
Activate the focused control.
Space
Activate the focused control.

Demos

Close Trigger

Controlled

Custom Spacing

Dialog

Gutter

Positioning

Table

API Reference

ActionBar

PropType

ActionBarTrigger

button

PropType
AttributeType
CSS variableType
--gutterstring

ActionBarContent

div

PropType
AttributeType
CSS variableType
--spacestring

ActionBarSeparator

PropType
AttributeType

ActionBarClose

button

PropType
AttributeType

ActionBarValue

PropType
AttributeType

ActionBarBody

div

PropType
AttributeType