v0.0.2
Demos (demo panel, opens in a new tab)

Loading overlay

Covers an area with a semi-transparent layer while something runs and blocks clicks on it.

zb:loading-overlay zubazar/ui-pro

PRO

This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →

With Alpine

With Alpine: view
BLADE

show is an Alpine expression, and the overlay shows while it is true; give the area to lock the relative class.

blade
<div class="relative rounded-sm border border-line p-6" x-data="{ locked: false }">
    <p class="text-sm text-dim">This area is locked while the report is being prepared.</p>
    <zb:button class="mt-4" size="sm" x-on:click="locked = true; setTimeout(() => locked = false, 2000)">Prepare report</zb:button>
    <zb:loading-overlay show="locked" label="Preparing" />
</div>
PropValues
showAlpine expression

Label

Label: view
BLADE

label adds visible text next to the indicator and also reads it to screen readers.

blade
<div class="grid gap-4 sm:grid-cols-2">
    <div class="relative h-32 rounded-sm border border-line p-4">
        <p class="text-sm text-dim">Customer list</p>
        <zb:loading-overlay />
    </div>
    <div class="relative h-32 rounded-sm border border-line p-4">
        <p class="text-sm text-dim">Sales report</p>
        <zb:loading-overlay label="Preparing the report" />
    </div>
</div>
PropValues
labelText next to the indicator

With Livewire

BLADE

target takes one or several comma-separated Livewire actions or properties (wire:target); the overlay shows only while those requests run.

blade
<div class="relative">
    <zb:table>…</zb:table>
    <zb:loading-overlay target="search,sort,gotoPage" />
</div>
PropValues
targetAction name | name1,name2

Props

The values the component takes. What are props and slots?

PropTypeDefaultDescription
target—nullLivewire action (wire:target); several separated by commas
show—nullAlpine expression; visible while true
label—nullVisible text and screen reader label

Developer notes

Events, hooks and details
  • The overlay covers the nearest relative container.
  • Without show and target, the overlay is always on.
Zubazar UI · ZubazarDesigned for people.