Mahmoud Al-HabashOpen to new projects
  • WorkWork
  • ServicesServices
  • LabLab
  • WritingWriting
  • ContactContact
Amman--:--عربي
Writing/Laravel

Livewire Progress Indicators

Show progress indicators for long-running operations.

16 January 20261 min readLaravelاقرأ بالعربية

On this page

  1. Simple Progress Bar
  2. View
  3. With Steps

Progress indicators:

Simple Progress Bar

php
public int $progress = 0;

public function processItems()
{
    $items = Item::all();
    $total = $items->count();
    
    foreach ($items as $index => $item) {
        $item->process();
        $this->progress = (($index + 1) / $total) * 100;
    }
}

View

blade
<div class="progress-bar" style="width: {{ $progress }}%"></div>
<span>{{ $progress }}%</span>

<button wire:click="processItems">
    <span wire:loading.remove>Start</span>
    <span wire:loading>Processing...</span>
</button>

With Steps

php
public int $currentStep = 1;
public int $totalSteps = 5;
All articles

Keep reading

  • Laravel Action Classes Pattern16 January 20261 min read
  • Laravel Action Classes: Single Responsibility16 January 20261 min read
  • Laravel API Rate Limiting16 January 20261 min read