Skeleton
A gray, softly pulsing placeholder in the shape of content that is loading, so the page does not jump when it arrives.
zb:skeleton zubazar/ui · free (MIT)
Variants
BLADE
Pick the shape with variant (block, text for a line of text, circle for an avatar); set width and height with class.
<div class="flex items-center gap-4">
<zb:skeleton class="h-16 w-24" />
<zb:skeleton variant="circle" class="size-12" />
<div class="flex-1 space-y-2">
<zb:skeleton variant="text" />
<zb:skeleton variant="text" class="w-2/3" />
</div>
</div>
| Prop | Values |
|---|---|
variant | block | text | circle |
class | Size classes (e.g. h-16 w-24, size-12, w-2/3) |
Card skeleton
BLADE
Combine the parts to sketch the card that will load; varied line widths look like real text.
<zb:card>
<div class="flex items-center gap-3">
<zb:skeleton variant="circle" class="size-10" />
<div class="flex-1 space-y-2">
<zb:skeleton variant="text" class="w-2/3" />
<zb:skeleton variant="text" class="w-1/3" />
</div>
</div>
<zb:skeleton class="mt-4 h-24" />
</zb:card>
List skeleton
BLADE
While a list loads, generate a few skeleton rows with a loop; keep the count close to the expected number of records.
<div class="divide-y divide-line-soft rounded-sm bg-surface shadow-sm">
@foreach (range(1, 4) as $row)
<div class="flex items-center gap-4 px-4 py-3">
<zb:skeleton variant="text" class="w-1/3" />
<zb:skeleton variant="text" class="w-1/5" />
<zb:skeleton class="ms-auto h-5 w-14 rounded-full" />
</div>
@endforeach
</div>
With Livewire
BLADE
While an action runs, show the skeleton with wire:loading, hide the content with wire:loading.remove and tie both to the action with wire:target.
<div wire:loading wire:target="refreshReport" class="w-full space-y-2">
<zb:skeleton variant="text" class="w-3/4" />
<zb:skeleton variant="text" class="w-1/2" />
</div>
<div wire:loading.remove wire:target="refreshReport">
@include('reports.summary')
</div>
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
variant | — | block | block · text (h-3) · circle; the size is set with class |