EN
Getting started
18 · Cards

Cards with actions

The actions area in the card header: a dropdown, buttons, collapsing and closing. While the content refreshes, the card is locked with acun:loading-overlay.

PRO acun:card
02

Buttons, collapsing and closing

The actions content always sits to the left of the collapse and close buttons. Keep one or two actions in the header; move the rest into a dropdown.

LIVE EXAMPLE
<acun:card title="Daily summary" collapsible closable>
    <acun:slot:actions>
        <acun:button size="sm" variant="ghost">All</acun:button>
    </acun:slot:actions>
    <p class="text-sm text-gray-600 dark:text-zinc-400">214 orders came in today; 18 orders were canceled.</p>
</acun:card>
PropValues
collapsibletrue | false
closabletrue | false
03

Locking while refreshing

Wrap the card in a relative container and put an acun:loading-overlay next to it; the card stays locked as long as the Alpine expression given in show is true. In the example, pressing Refresh locks the card for 1.5 seconds.

LIVE EXAMPLE
<div class="relative" x-data="{ loading: false }">
    <acun:card title="Pending orders">
        <acun:slot:actions>
            <acun:button size="sm" variant="ghost" x-on:click="loading = true; setTimeout(() => loading = false, 1500)">Refresh</acun:button>
        </acun:slot:actions>
        <p class="text-sm text-gray-600 dark:text-zinc-400">36 orders are waiting to ship.</p>
    </acun:card>
    <acun:loading-overlay show="loading" />
</div>
PropValues
show (loading-overlay)Alpine expression
04

Refreshing with Livewire

In a Livewire component, give the overlay the name of the action with target; while that action runs, the card is locked automatically.

BLADE
<div class="relative">
    <acun:card title="Today's orders">
        <acun:slot:actions>
            <acun:button size="sm" variant="ghost" wire:click="refresh">Refresh</acun:button>
        </acun:slot:actions>
        …
    </acun:card>
    <acun:loading-overlay target="refresh" />
</div>
PropValues
target (loading-overlay)Livewire action name
API

Props and slots

The values the component accepts.

PropDefaultDescription
title, subtitlenullHeader area
collapsiblefalseCollapse button in the header
closablefalseClose button in the header
paddingtruefalse: body without padding
loading-overlay: show · targetnullAlpine expression · Livewire action
Slots: actions (right of the header), footer (footer), default content (body)
Acun UI · Cards with actionsDetailed usage and examples