Pagination
Pagination is used for splitting up results into several pages and provides controls for navigating to the next or previous page.
Default
Default with Prefix and Suffix
Default - hide counter
Default - hide counter / centered
Default - hide counter and hide pages
Default - hide counter and hide pages / centered
Sage Component
SagePagination
<h3 class="t-sage-heading-6">Default</h3>
<%= sage_component SagePagination, {
items: Kaminari.paginate_array(Array.new(30, 1)).page(1).per(2),
collection_name: "Record",
window: 2,
hide_pages: false,
} %>
<h3 class="t-sage-heading-6">Default with Prefix and Suffix</h3>
<%= sage_component SagePagination, {
items: Kaminari.paginate_array(Array.new(30, 1)).page(1).per(10),
collection_name: "Record",
window: 2,
hide_counter: false,
hide_pages: false,
page_count_prefix: "Presenting",
page_count_suffix: "in the last <strong>30 days</strong>".html_safe,
} %>
<h3 class="t-sage-heading-6">Default - hide counter</h3>
<%= sage_component SagePagination, {
items: Kaminari.paginate_array(Array.new(30, 1)).page(1).per(10),
collection_name: "Record",
window: 2,
hide_counter: true,
hide_pages: false,
} %>
<h3 class="t-sage-heading-6">Default - hide counter / centered</h3>
<%= sage_component SagePagination, {
items: Kaminari.paginate_array(Array.new(30, 1)).page(1).per(1),
collection_name: "Record",
window: 2,
align: "center",
hide_counter: true,
hide_pages: false,
} %>
<h3 class="t-sage-heading-6">Default - hide counter and hide pages</h3>
<%= sage_component SagePagination, {
items: Kaminari.paginate_array(Array.new(30, 1)).page(1).per(10),
collection_name: "Record",
window: 2,
hide_counter: true,
hide_pages: true,
} %>
<h3 class="t-sage-heading-6">Default - hide counter and hide pages / centered</h3>
<%= sage_component SagePagination, {
items: Kaminari.paginate_array(Array.new(30, 1)).page(1).per(10),
collection_name: "Record",
window: 2,
align: "center",
hide_counter: true,
hide_pages: true,
} %>
Property | Description | Type | Default |
---|---|---|---|
align |
Pagination uses a |
"center" |
|
current |
Pagination uses a |
String |
|
disabled |
Pagination uses a |
String |
|
gap |
When there are many pages, a |
String |
|
|
When set to |
Boolean |
|
|
When set to |
Boolean |
|
|
Maps records to create page link items |
Object |
|
|
Allows string to be added before the page count text. |
String |
|
|
Allows string to be added after the page count text. |
String |
|
|
Sets the number of items on either side of the |
Integer |
|