|  | 
| 1 |  | -[](https://www.npmjs.com/package/laravel-vue-pagination) [](https://www.npmjs.com/package/laravel-vue-pagination) | 
|  | 1 | +[](https://www.npmjs.com/package/laravel-vue-pagination) [](https://www.npmjs.com/package/laravel-vue-pagination) [](https://github.com/gilbitron/laravel-vue-pagination/actions/workflows/tests.yml) | 
| 2 | 2 | 
 | 
| 3 | 3 | > Want your logo here? [Sponsor me on GitHub](https://github.com/users/gilbitron/sponsorship) | 
| 4 | 4 | 
 | 
| 5 | 5 | # Laravel Vue Pagination | 
| 6 | 6 | 
 | 
| 7 |  | -A Vue.js pagination component for Laravel paginators. | 
|  | 7 | +Laravel Vue Pagination is a Vue.js pagination component for Laravel. It provides out-of-the-box components for Bootstrap 4/5 and Tailwind CSS. | 
| 8 | 8 | 
 | 
| 9 |  | -## Requirements | 
|  | 9 | +## Documentation | 
| 10 | 10 | 
 | 
| 11 |  | -* [Vue.js](https://vuejs.org/) 3 | 
| 12 |  | -* [Laravel](http://laravel.com/docs/) 5+ | 
| 13 |  | -* [Bootstrap](http://getbootstrap.com/) 4 | 
|  | 11 | +Complete documentation and demo available at [https://laravel-vue-pagination.org](https://laravel-vue-pagination.org). | 
| 14 | 12 | 
 | 
| 15 |  | -For Vue 2 support use [v2](https://github.com/gilbitron/laravel-vue-pagination/releases/tag/2.3.2). | 
| 16 |  | - | 
| 17 |  | -## Install | 
| 18 |  | - | 
| 19 |  | -```bash | 
| 20 |  | -npm install laravel-vue-pagination | 
| 21 |  | -// or | 
| 22 |  | -yarn add laravel-vue-pagination | 
| 23 |  | -``` | 
| 24 |  | - | 
| 25 |  | -## Usage | 
| 26 |  | - | 
| 27 |  | -Register the component: | 
| 28 |  | - | 
| 29 |  | -```javascript | 
| 30 |  | -import LaravelVuePagination from 'laravel-vue-pagination'; | 
| 31 |  | - | 
| 32 |  | -export default { | 
| 33 |  | -    components: { | 
| 34 |  | -        'Pagination': LaravelVuePagination | 
| 35 |  | -    } | 
| 36 |  | -} | 
| 37 |  | -``` | 
| 38 |  | - | 
| 39 |  | -Use the component: | 
| 40 |  | - | 
| 41 |  | -```html | 
| 42 |  | -<ul> | 
| 43 |  | -    <li v-for="post in laravelData.data" :key="post.id">{{ post.title }}</li> | 
| 44 |  | -</ul> | 
| 45 |  | - | 
| 46 |  | -<Pagination :data="laravelData" @pagination-change-page="getResults" /> | 
| 47 |  | -``` | 
| 48 |  | - | 
| 49 |  | -```javascript | 
| 50 |  | -export default { | 
| 51 |  | -    data() { | 
| 52 |  | -        return { | 
| 53 |  | -            // Our data object that holds the Laravel paginator data | 
| 54 |  | -            laravelData: {}, | 
| 55 |  | -        } | 
| 56 |  | -    }, | 
| 57 |  | - | 
| 58 |  | -    mounted() { | 
| 59 |  | -        // Fetch initial results | 
| 60 |  | -        this.getResults(); | 
| 61 |  | -    }, | 
| 62 |  | - | 
| 63 |  | -    methods: { | 
| 64 |  | -        // Our method to GET results from a Laravel endpoint | 
| 65 |  | -        getResults(page = 1) { | 
| 66 |  | -            axios.get('example/results?page=' + page) | 
| 67 |  | -                .then(response => { | 
| 68 |  | -                    this.laravelData = response.data; | 
| 69 |  | -                }); | 
| 70 |  | -        } | 
| 71 |  | -    } | 
| 72 |  | - | 
| 73 |  | -} | 
| 74 |  | -``` | 
| 75 |  | - | 
| 76 |  | -### Customizing Prev/Next Buttons | 
| 77 |  | - | 
| 78 |  | -Prev/Next buttons can be customized using the `prev-nav` and `next-nav` slots: | 
| 79 |  | - | 
| 80 |  | -```html | 
| 81 |  | -<pagination :data="laravelData"> | 
| 82 |  | -    <template #prev-nav> | 
| 83 |  | -        <span>< Previous</span> | 
| 84 |  | -    </template> | 
| 85 |  | -    <template #next-nav> | 
| 86 |  | -        <span>Next ></span> | 
| 87 |  | -    </template> | 
| 88 |  | -</pagination> | 
| 89 |  | -``` | 
| 90 |  | - | 
| 91 |  | -## API | 
| 92 |  | - | 
| 93 |  | -### Props | 
| 94 |  | - | 
| 95 |  | -| Name | Type | Description | | 
| 96 |  | -| --- | --- | --- | | 
| 97 |  | -| `data` | Object | An object containing the structure of a [Laravel paginator](https://laravel.com/docs/8.x/pagination) response or a [Laravel API Resource](https://laravel.com/docs/8.x/eloquent-resources) response. | | 
| 98 |  | -| `limit` | Number | (optional) Limit of pages to be rendered. `0` shows all pages (default). `-1` will hide numeric pages and leave only arrow navigation. Any positive integer (e.g. `2`) will define how many pages should be shown on either side of the current page when only a range of pages are shown. | | 
| 99 |  | -| `show-disabled` | Boolean | (optional) Show disabled prev/next buttons instead of hiding them. `false` hides disabled buttons (default). `true` shows disables buttons. | | 
| 100 |  | -| `size` | String | (optional) One of `small`, `default` or `large` | | 
| 101 |  | -| `align` | String | (optional) One of `left` (default), `center` or `right` | | 
|  | 13 | +## Show your Support | 
| 102 | 14 | 
 | 
| 103 |  | -### Events | 
|  | 15 | +To show your support for my work on this project: | 
| 104 | 16 | 
 | 
| 105 |  | -| Name | Description | | 
| 106 |  | -| --- | --- | | 
| 107 |  | -| `pagination-change-page` | Triggered when a user changes page. Passes the new `page` index as a parameter. | | 
|  | 17 | +* [Star this repository](https://github.com/gilbitron/laravel-vue-pagination/stargazers) | 
|  | 18 | +* [Tell others about this project](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fgilbitron%2Flaravel-vue-pagination) | 
|  | 19 | +* [Sponsor me on GitHub](https://github.com/users/gilbitron/sponsorship) | 
| 108 | 20 | 
 | 
| 109 | 21 | ## Development | 
| 110 | 22 | 
 | 
| 111 | 23 | To work on the library locally, run the following command: | 
| 112 | 24 | 
 | 
| 113 | 25 | ```bash | 
| 114 |  | -npm run serve | 
|  | 26 | +yarn dev | 
| 115 | 27 | ``` | 
| 116 | 28 | 
 | 
| 117 | 29 | To run the tests: | 
| 118 | 30 | 
 | 
| 119 | 31 | ```bash | 
| 120 |  | -npm run test | 
|  | 32 | +yarn test | 
| 121 | 33 | ``` | 
| 122 | 34 | 
 | 
| 123 |  | -## Show your Support | 
| 124 |  | - | 
| 125 |  | -To show your support for my work on this project: | 
| 126 |  | - | 
| 127 |  | -* [Star this repository](https://github.com/gilbitron/laravel-vue-pagination/stargazers) | 
| 128 |  | -* [Tell others about this project](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fgilbitron%2Flaravel-vue-pagination) | 
| 129 |  | -* [Sponsor me on GitHub](https://github.com/users/gilbitron/sponsorship) | 
| 130 |  | - | 
| 131 | 35 | ## Credits | 
| 132 | 36 | 
 | 
| 133 |  | -Laravel Vue Pagination was created by [Gilbert Pellegrom](https://gilbitron.me) from [Dev7studios](https://dev7studios.co). Released under the MIT license. | 
|  | 37 | +Laravel Vue Pagination was created by [Gilbert Pellegrom](https://gilbitron.me). Released under the MIT license. | 
0 commit comments