Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

wire:loading Indicator

Premium
2 min read

Imagine you have big data that needs to be loaded into a table. Besides the Lazy Loading component, another method uses wire:loading directive which has a bit more features.


First, add a div element with the wire:loading directive above the table.

resources/views/livewire/products.blade.php:

<div class="space-y-6">
<div class="space-x-8">
// ...
</div>
<div class="text-red-600" wire:loading>Loading...</div>
<div class="min-w-full align-middle">
// ...
</div>
{{ $products->links() }}
</div>

Simulate longer loading by adding sleep(1) to the Livewire component render method. Then try to search, and you should see a...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (29 h 14 min)

You also get:

54 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

N
Nurbek ✓ Link copied!

why, when I write something, the first time the download works and gives out posts, the next process does not work just loading and opacity-50

M
Modestas ✓ Link copied!

Can you expand on this? Not sure I fully understand what you had in mind

FF
Francisco Ferreira Roque Júnior ✓ Link copied!

Hey Polivas, The "You can target a specific action by adding the wire:target="methodName" directive." looks like don't belongs to this class, but if it does, sorry, I just don't understand the context.

Thanks sir.

N
Nerijus ✓ Link copied!

In this example we have a button with an action remove. Where we use wire:loading we alsp use the wire:target and specify that remove method. This means while remove is being executed the wire:loading div will be active. Hope this helps.

FF
Francisco Ferreira Roque Júnior ✓ Link copied!

Thank you very much Nerijus, now I understood the point.

HM
Hossam Mohamed ✓ Link copied!

I search for the lesson of how to make the loading indicator at Livewire , alpine js and Js I see this lesson at laraveldaily but now i can't get useful result from the search

N
Nerijus ✓ Link copied!

If you need help will need more than that

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.