Skip to main content
Copy for LLM

Action Bar

The <x-wirekit::action-bar> component creates a floating toolbar that appears at the bottom of the viewport — typically used for bulk actions when one or more items are selected in a list or table. It uses role="group" — a named set of related controls, each reached with Tab — and announces its presence to screen readers via a live region.

Usage

The preview below uses mode="static" so the bar renders inline within the docs preview frame. The default mode="floating" pins the bar to the bottom-center of the viewport via position: fixed — see Layout Modes for the full positioning details and when to choose each.

Action Bar (static mode)
3 items selected

With Livewire

The visible prop is typically bound to a Livewire computed property or state. The bar appears when items are selected and disappears when the selection is cleared. The count goes into the summary slot, which the bar shows first and says to a screen reader (Announcing the Count).

{{-- In your Livewire component's view --}}
<x-wirekit::action-bar :visible="count($this->selected) > 0">
    <x-slot:summary>{{ count($this->selected) }} selected</x-slot:summary>

    <x-wirekit::button size="sm" wire:click="exportSelected">
        Export
    </x-wirekit::button>

    <x-wirekit::button size="sm" intent="neutral" wire:click="clearSelection">
        Clear
    </x-wirekit::button>

    <x-wirekit::button size="sm" intent="danger" wire:click="deleteSelected">
        Delete
    </x-wirekit::button>
</x-wirekit::action-bar>

Announcing the Count

Give the count to the summary slot, as above, rather than to the bar's body. It shows first in the bar, and the bar's live region says it in place of "Bulk actions available": "3 selected" when the bar appears, "4 selected" when your component renders the next count. A count written into the body is shown and never said.

{{-- 1. The count in `summary`: shown in the bar and said on each change. --}}
<x-wirekit::action-bar :visible="count($this->selected) > 0">
    <x-slot:summary>{{ count($this->selected) }} selected</x-slot:summary>

    <x-wirekit::button size="sm" wire:click="archiveSelected">Archive</x-wirekit::button>
</x-wirekit::action-bar>
The count in the summary slot
3 selected

The visible copy is hidden from screen readers, so the count is not read twice; the region stands before the bar in the page. As with the bar's own sentence, a change is said when the server renders it; under Alpine-controlled visibility the announcement stays yours.

Custom Content

The action bar accepts any content in its default slot — buttons, text, badges, or any other components:

<x-wirekit::action-bar :visible="$hasUnsavedChanges">
    <x-wirekit::icon name="warning" class="text-[color:var(--color-wk-warning-text)]" />
    <span>You have unsaved changes</span>
    <x-wirekit::button size="sm" wire:click="save">Save</x-wirekit::button>
    <x-wirekit::button size="sm" intent="neutral" wire:click="discard">Discard</x-wirekit::button>
</x-wirekit::action-bar>

Alpine-Controlled Visibility

You can also control visibility with Alpine instead of server-side Livewire state:

<div x-data="orderSelection">
    {{-- 1. Each row's checkbox sets its order to true or false. --}}
    <x-wirekit::checkbox id="order-1042" label="Order #1042" x-model="order1042" />
    <x-wirekit::checkbox id="order-1043" label="Order #1043" x-model="order1043" />

    {{-- 2. The bar is in the page from the start; Alpine shows it while a row is checked. --}}
    <x-wirekit::action-bar x-show="hasSelection()" :visible="true">
        <span x-text="selectionLabel()"></span>
        <x-wirekit::button size="sm" intent="neutral" @click="clear()">Clear selection</x-wirekit::button>
    </x-wirekit::action-bar>
</div>
// 3. The logic lives in a component, so the template also runs on Alpine's CSP build.
Alpine.data('orderSelection', () => ({
    order1042: false,
    order1043: false,
    selectedCount() {
        return [this.order1042, this.order1043].filter(Boolean).length;
    },
    hasSelection() {
        return this.selectedCount() > 0;
    },
    selectionLabel() {
        return this.selectedCount() + ' selected';
    },
    clear() {
        this.order1042 = false;
        this.order1043 = false;
    },
}));

When using Alpine's x-show for visibility, set :visible="true" on the component so the server renders the bar in the DOM. Alpine will then control its display state client-side.

The built-in announcement is server-driven

A live region speaks when its text CHANGES while the region is already on the page. With :visible="true" the bar's text is there from first paint and Alpine only flips display, so the bar's own region stays silent and the announcement is yours to make — write the wording into an aria-live="polite" element of your own when selected.length crosses zero. Server-driven visibility (:visible="$hasSelection" re-rendered by Livewire) announces on its own, because the flip is what changes the text.

Layout Modes

The action bar ships in two layout modes, controlled by the mode prop. Both share the same chrome — bordered, elevated, rounded, padded — and only the positioning differs.

mode="floating" (default)

Pinned to the bottom center of the viewport via position: fixed:

  • position: fixed with bottom spacing from --padding-wk-y-lg
  • Horizontally centered via left: 50% + transform: translateX(-50%)
  • z-index from --z-wk-sticky — sits above page content but below modals and drawers

While it is shown, a field a reader tabs to near the bottom of the screen comes to rest above the bar rather than behind it (keeping the focus clear of a pinned bar).

This is the default mode and the right choice for list pages where the bar should hover over the content while the user scrolls. Visible regardless of scroll position.

mode="static"

Renders inline with surrounding content (inline-flex) — drops the fixed positioning and the viewport-centering transforms, keeps the same visual chrome:

<x-wirekit::action-bar mode="static" :visible="true">
    <span>3 selected</span>
    <x-wirekit::button size="sm">Archive</x-wirekit::button>
    <x-wirekit::button size="sm" intent="danger">Delete</x-wirekit::button>
</x-wirekit::action-bar>

Use this mode when the bar belongs to a card / panel / dashboard rather than a viewport-floating overlay — for example a "selected items" toolbar inside a section, or a contextual bar inside a tab. Composes cleanly with normal flow layouts (flex, grid, document order).

Where the summary and the actions of a static bar do not fit side by side, on a phone or in a narrow card, they continue on a second line instead of running past the container. A floating bar keeps one line.

Behavior

  • Server-rendered visibility — when visible is false, the component renders with the hidden class, so it stays hidden under a style-src policy that drops inline styles
  • Livewire-friendly — the visible prop re-evaluates on every Livewire render cycle, so the bar appears/disappears automatically as the selection state changes
  • Slot-based — the action bar has no opinion about its content; you fill it with buttons, text, or any other components

Props

Prop Type Default Description
visible bool false Whether the action bar is currently visible
mode string 'floating' Layout mode: 'floating' (viewport-pinned, the default) or 'static' (inline)
scope string|null null Scoped personalization key

Slots

Slot Purpose
default The bar's content: the buttons, and any text
summary The count of what the bar acts on, "3 selected": shown first in the bar and said by its live region on each change

Accessibility

  • Container: role="group" — announces the bar as one named set of related controls
  • aria-label="Bulk actions" — provides an accessible name describing the group's purpose
  • Live region: aria-live="polite" announces "Bulk actions available" to screen readers when the server renders the bar visible, or the summary slot in its place, again on each change of it (see the note under Alpine-Controlled Visibility for the client-driven case)
  • All buttons inside the bar are natively keyboard-accessible
  • Focus ring visible on all interactive elements
  • Every string the bar speaks is translated — run php artisan vendor:publish --tag=wirekit-lang to override the wording
Why group and not toolbar

role="toolbar" is a promise about the keyboard: one tab stop for the whole bar, arrow keys moving between the controls inside it. The action bar binds no keys — it is a layout wrapper, and its children are ordinary buttons that Tab reaches one by one. role="group" describes exactly that. If you want the arrow-key model, use <x-wirekit::toolbar>.

Keyboard Interaction

This component is a layout wrapper. Keyboard interaction is delegated to its children.

Pitfalls

  • Don't use action-bar as a permanent UI. It's purpose-built for transient bulk-action contexts (selected rows). For persistent action surfaces use <x-wirekit::toolbar>.

Design Tokens

Token Used for
--font-wk-sans Action-bar font family
--text-wk-md Action-bar font size
--color-wk-text Action-bar text
--color-wk-bg-elevated Action-bar background
--color-wk-border Action-bar border
--border-wk-width Border width
--radius-wk-xl Container border radius
--shadow-wk-lg Floating-mode drop shadow
--gap-wk-md Gap between action buttons
--padding-wk-x-lg / --padding-wk-y-lg Container padding, the same on every side, and the distance from the bottom edge when fixed
--z-wk-sticky Floating-mode stacking context

Personalization

Override classes globally via WireKit::personalize():

use Pushery\WireKit\WireKit;

WireKit::personalize('action-bar', [
    // An inverse pill: swaps the surface, the text color, the border and the corners.
    'base' => fn (string $vendor): string => str_replace(
        ['bg-[var(--color-wk-bg-elevated)]', 'text-[color:var(--color-wk-text)]', 'border-[var(--color-wk-border)]', 'rounded-[var(--radius-wk-xl)]'],
        ['bg-[var(--color-wk-bg-inverse)]', 'text-[color:var(--color-wk-text-inverse)]', 'border-transparent', 'rounded-[var(--radius-wk-full)]'],
        $vendor,
    ),
]);

The closure keeps the rest of the block, and the block also holds where the bar sits: fixed, centered, on its layer, and lifted by the phone's safe-area inset so it clears the home indicator. A plain string would replace those along with the look.

Further Reading

Updated in WireKit v2.73.0 (2026-11-08)

Was this page helpful?

Thank you for your feedback!

Voting requires cookies or local storage. What we store