ais-pagination
<ais-pagination // Optional parameters :show-first="boolean" :show-previous="boolean" :show-next="boolean" :show-last="boolean" :padding="number" :total-pages="number" :class-names="object" />
1
2
3
4
5
6
7
8
9
import { AisPagination } from 'vue-instantsearch';
// Use 'vue-instantsearch/vue3/es' for Vue 3
export default {
components: {
AisPagination
},
// ...
};
1. Follow additional steps in Optimize build size to ensure your code is correctly bundled.
2. This imports all the widgets, even the ones you don’t use. Read the Getting started guide for more information.
About this widget
The ais-pagination
widget displays a pagination system allowing the user to change the current page.
The Algolia search engine limits paginating to 1,000 hits per page.
Examples
1
<ais-pagination />
Props
Parameter | Description | ||
---|---|---|---|
show-first
|
type: boolean
default: true
Optional
Whether to display the first page link. |
||
Copy
|
|||
show-previous
|
type: boolean
default: true
Optional
Whether to display the previous page link. |
||
Copy
|
|||
show-next
|
type: boolean
default: true
Optional
Whether to display the next page link. |
||
Copy
|
|||
show-last
|
type: boolean
default: true
Optional
Whether to display the last page link. |
||
Copy
|
|||
padding
|
type: number
default: 3
Optional
How many page links to display around the current page. |
||
Copy
|
|||
total-pages
|
type: number
default: Infinity
Optional
The maximum number of pages to display (and to allow navigating to). |
||
Copy
|
|||
class-names
|
type: object
default: {}
Optional
The CSS classes to override.
|
||
Copy
|
Customize the UI
Parameter | Description | ||
---|---|---|---|
default
|
The slot to override the complete DOM output of the widget. Note that when you implement this slot, none of the other slots will change the output, as the default slot surrounds them. Scope
|
||
Copy
|
HTML output
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<div class="ais-Pagination">
<ul class="ais-Pagination-list">
<li class="ais-Pagination-item ais-Pagination-item--firstPage ais-Pagination-item--disabled">
<span class="ais-Pagination-link" aria-label="First">‹‹</span>
</li>
<li class="ais-Pagination-item ais-Pagination-item--previousPage ais-Pagination-item--disabled">
<span class="ais-Pagination-link" aria-label="Previous">‹</span>
</li>
<li class="ais-Pagination-item ais-Pagination-item--selected">
<a class="ais-Pagination-link" href="#">1</a>
</li>
<li class="ais-Pagination-item ais-Pagination-item--page">
<a class="ais-Pagination-link" href="#">2</a>
</li>
<li class="ais-Pagination-item ais-Pagination-item--page">
<a class="ais-Pagination-link" href="#">3</a>
</li>
<li class="ais-Pagination-item">
<a class="ais-Pagination-link" href="#">4</a>
</li>
<li class="ais-Pagination-item ais-Pagination-item--nextPage">
<a class="ais-Pagination-link" aria-label="Next" href="#">›</a>
</li>
<li class="ais-Pagination-item ais-Pagination-item--lastPage">
<a class="ais-Pagination-link" aria-label="Last" href="#">››</a>
</li>
</ul>
</div>
If SEO is critical to your search page, your custom HTML markup needs to be parsable:
- use plain
<a>
tags withhref
attributes for search engines bots to follow them, - use semantic markup with structured data when relevant, and test it.
Refer to our SEO checklist for building SEO-ready search experiences.