How to Create Laravel 10 Vue 3 Pagination with Vite

In this article, we will see how to create laravel 10 vue 3 pagination with vite. Here, we will learn about vue 3 pagination with vite in laravel 10. Enhance your web application's user experience by implementing pagination with Vue 3 and Vite.

Follow this guide to seamlessly integrate pagination into your Vue 3 projects, leveraging the speed and efficiency of Vite's build tool. Learn the step-by-step process to set up Vue 3, utilize Vite's advantages, and create dynamic pagination components to efficiently navigate and display large datasets. Elevate your Vue 3 development with Vite-powered pagination.

Pagination is a crucial feature for managing large datasets and improving navigation within your application. With Vue 3's enhanced reactivity and Vite's blazing-fast build tool, you can create dynamic and efficient pagination components that seamlessly integrate into your Vue projects.

Vue 3, the latest version of the popular JavaScript framework, introduces powerful features like the Composition API and enhanced reactivity, making it easier than ever to build robust and scalable applications.

Vite, a next-generation build tool, offers lightning-fast development and hot module replacement, significantly improving the development experience.

By combining Vue 3's capabilities with Vite's performance benefits, you can create a responsive and interactive pagination system. This allows users to navigate through paginated content effortlessly, reducing load times and improving overall responsiveness.

In this guide, you'll learn step-by-step how to set up Vue 3 and leverage Vite's advantages. You'll discover how to create reusable pagination components that dynamically update content based on user interactions. Additionally, you'll explore techniques for making efficient API calls, handling server-side pagination, and updating the UI seamlessly.

To create Laravel 10 Vue 3 pagination with Vite, follow these steps:

Step 1: Set up a Laravel 10 project

Install Laravel 10 by following the official documentation. Create a new Laravel project using the following command.

composer create-project --prefer-dist laravel/laravel larave-vue-pagination


Step 2: Install Laravel Pagination Package

Laravel 10 comes with built-in pagination support. However, to make it compatible with Vue 3 and Vite, we'll use the "laravel-vue-pagination" package. Install the package using the following command.

npm install laravel-vue-pagination


Step 3: Set up Vue 3 and Vite
  • Laravel 10 has built-in support for Vue.js. To use Vue 3 and Vite, make the necessary changes to the default configuration.
  • Install Vue 3 and Vite by following the official documentation.
  • Update the package.json file with the necessary dependencies and scripts.
  • Create a resources/js directory if it doesn't exist and move your Vue components to that directory.



window.Vue = require('vue').default;

Vue.component('users', require('./components/Users.vue').default);

const app = new Vue({
    el: '#app',



Step 4: Create a Vue Pagination Component
  • Create a new Vue component for pagination. For example, create a file named Users.vue in the resources/js/components directory.
  • Add the necessary markup and logic for the pagination component.
  • Ensure to emit events or use props to pass the necessary pagination data to the component.


    <div class="container my-5">
        <div class="row justify-content-center">
            <div class="col-md-10">
                <div class="card">
                    <div class="card-header text-center">
                        <h2>How to Create Laravel 10 Vue 3 Pagination with Vite - Techsolutionstuff</h2>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table table-bordered text-center">
                                <tbody v-if="users && > 0">
                                    <tr v-for="(user,index) in" :key="index">
                                        <td>{{ }}</td>
                                        <td>{{ }}</td>
                                        <td>{{ }}</td>
                                <tbody v-else>
                                        <td align="center" colspan="3">No record found.</td>
                        <pagination align="center" :data="users" @pagination-change-page="list"></pagination>

    import pagination from 'laravel-vue-pagination'
    export default {
            return {
            async list(page=1){
                await axios.get(`/api/users?page=${page}`).then(({data})=>{
                    this.users = data
                }).catch(({ response })=>{

<style scoped>
        margin-bottom: 0;


Step 5: Create Routes in web.php File

In the web.php file add the below code to the file.

use App\Http\Controllers\API\UserController;



Step 6: Implement Pagination in Laravel Controller
  • In your Laravel controller method that fetches the paginated data, utilize Laravel's built-in pagination feature.
  • Pass the paginated data to the view or API response.



namespace App\Http\Controllers\API;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\User;

class UserController extends Controller
    public function index(){
        $users = User::paginate(10);
    	return response()->json($users);


Step 7: Use the Pagination Component in Your Blade Template or Vue Component
  • Include the Vue app and Vite assets in your Blade template or Vue component.
  • Use the <pagination> the component in your template and pass the necessary props or events.
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>How to Create Laravel 10 Vue 3 Pagination with Vite - Techsolutionstuff</title>
        <link rel="stylesheet" type="text/css" href="{{ mix('css/app.css') }}">
        <div id="app">
        <script type="text/javascript" src="{{ mix('js/app.js') }}"></script>

Now run the below command to update the app.js file:

npm run dev


You might also like: 


Techsolutionstuff | The Complete Guide

I'm a software engineer and the founder of Hailing from India, I craft articles, tutorials, tricks, and tips to aid developers. Explore Laravel, PHP, MySQL, jQuery, Bootstrap, Node.js, Vue.js, and AngularJS in our tech stack.