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

Livewire Pagination: Custom Styles and Infinite Scroll

Implement pagination in Livewire with custom styles or infinite scrolling.

24 December 20251 min readLaravelاقرأ بالعربية

On this page

  1. Basic Pagination
  2. In Blade Template
  3. Infinite Scroll
  4. Reset Page on Search

Pagination in Livewire:

Basic Pagination

php
public function render()
{
    return view('livewire.posts', [
        'posts' => Post::paginate(10)
    ]);
}

In Blade Template

blade
@foreach($posts as $post)
    <!-- Display post -->
@endforeach
{{ $posts->links() }}

Infinite Scroll

blade
<div wire:init="loadMore">
    @foreach($posts as $post)
        <!-- Display post -->
    @endforeach
</div>

Reset Page on Search

php
public function updatingSearch()
{
    $this->resetPage();
}
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