Laravel Livewire Load More OnScroll Example

By Hardik Savani April 16, 2024 Category : Laravel

Hi All,

In this tutorial we will go over the demonstration of laravel livewire load more data example. i would like to share with you laravel livewire onscroll load more data. you will learn auto load more data on page scroll laravel livewire. let’s discuss about laravel 8 livewire load more example. you will do the following things for load more data on page scroll in laravel livewire.

In this tutorial, we will create simple load more data on scroll example using laravel livewire. you can use laravel livewire load more with laravel 6, laravel 7, laravel 8, laravel 9, laravel 10 and laravel 11 version.

Here, i will give you very simple example to creating load more data on window scroll event example with laravel. we will use only livewire/livewire package.

So, let's follow bellow step and you will get bellow layout:

Step 1: Install Laravel 8

first of all we need to get fresh Laravel 8 version application using bellow command, So open your terminal OR command prompt and run bellow command:

composer create-project --prefer-dist laravel/laravel blog

Step 2: Create Dummy Records using Tinker Factory

you need to run following command to create dummy records in your users table. let's run both command:

php artisan tinker


Step 3: Install Livewire

now in this step, we will simply install livewire to our laravel 8 application using bellow command:

composer require livewire/livewire

Step 4: Create Component

Now here we will create livewire component using their command. so run bellow command to create load more component.

php artisan make:livewire load-more-user

Now they created fies on both path:



Now both file we will update as bellow for our contact us form.



namespace App\Http\Livewire;

use Livewire\Component;

use App\Models\User;

class LoadMoreUser extends Component


public $perPage = 15;

protected $listeners = [

'load-more' => 'loadMore'



* Write code on Method


* @return response()


public function loadMore()


$this->perPage = $this->perPage + 5;



* Write code on Method


* @return response()


public function render()


$users = User::latest()->paginate($this->perPage);


return view('livewire.load-more-user', ['users' => $users]);





<div class="table-responsive">

<table class="table table-bordered">









@foreach($users as $user)


<td>{{ $user->id }}</td>

<td>{{ $user->name }}</td>

<td>{{ $user->email }}</td>







Step 5: Create Route

now we will create one route for calling our example, so let's add new route to web.php file as bellow:


Route::get('load-more-user', function () {

return view('default');


Step 6: Create View File

here, we will create blade file for call form route. in this file we will use @livewireStyles, @livewireScripts and @livewire('contact-form'). so let's add it.


<!DOCTYPE html>



<title>Laravel Livewire Example -</title>


<link rel="stylesheet" href="">



<div class="container">

<div class="card">

<div class="card-header">

Laravel Livewire Example -


<div class="card-body">







<script type="text/javascript">

window.onscroll = function(ev) {

if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {






Now you can run using bellow command:

php artisan serve

Open bellow URL:


I hope it can help you...