Loading overlay
Covers an area with a semi-transparent layer while something runs and blocks clicks on it.
zb:loading-overlay zubazar/ui-pro
This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →
With Alpine
BLADE
show is an Alpine expression, and the overlay shows while it is true; give the area to lock the relative class.
<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>
| Prop | Values |
|---|---|
show | Alpine expression |
Label
BLADE
label adds visible text next to the indicator and also reads it to screen readers.
<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>
| Prop | Values |
|---|---|
label | Text 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.
<div class="relative">
<zb:table>…</zb:table>
<zb:loading-overlay target="search,sort,gotoPage" />
</div>
| Prop | Values |
|---|---|
target | Action name | name1,name2 |
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
target | — | null | Livewire action (wire:target); several separated by commas |
show | — | null | Alpine expression; visible while true |
label | — | null | Visible text and screen reader label |
Developer notes
- The overlay covers the nearest
relativecontainer. - Without
showandtarget, the overlay is always on.