Example
Pagination items are automatically generated based on the total item count items
and how many items will be displayed on the page, configured using items-per-page
, with the default value being 20
. The currently selected page is kept synchronised using v-model
.
<i-pagination v-model="currentPage" :items="300" :items-per-page="20"></i-pagination>
export default {
data () {
return {
currentPage: 1
};
}
}
Variants
Inkline includes two predefined pagination styles. You can set the style of a <i-pagination>
using the variant
property, which can have a value of light
or dark
. By default, pagination uses the light
variant.
<i-pagination v-model="currentPage" variant="light" :items="100" :items-per-page="10"></i-pagination>
<i-pagination v-model="currentPage" variant="dark" :items="100" :items-per-page="10"></i-pagination>
export default {
data () {
return {
currentPage: 1
};
}
}
Sizes
You're able to use the size
modifier to control the size of your pagination items, using one of the available sizes: sm
, md
, and lg
. The default size is set to md
.
<i-pagination v-model="currentPage" size="sm" :items="100" :items-per-page="10"></i-pagination>
<i-pagination v-model="currentPage" size="md" :items="100" :items-per-page="10"></i-pagination>
<i-pagination v-model="currentPage" size="lg" :items="100" :items-per-page="10"></i-pagination>
export default {
data () {
return {
currentPage: 1
};
}
}
Limit
You're able to use the limit
modifier to control how many items to show besides the first and last items, including the two ellipsis pagination items.
Make sure this value is an odd number
for best results.
<i-pagination v-model="currentPage" :limit="3" :items="100" :items-per-page="10"></i-pagination>
export default {
data () {
return {
currentPage: 1
};
}
}
To make things even better, you can responsively control the number of items at each breakpoint, to make sure your design always looks great.
<i-pagination v-model="currentPage" :limit="pageLimit" :items="100" :items-per-page="10"></i-pagination>
export default {
data () {
return {
currentPage: 1,
pageLimit: {
xs: 3,
sm: 5,
md: 7
}
};
}
}
Quick Links
You're able to use the quickLink
modifier to allow the user to click the …
item to quickly jump through pages, a number of items equal to limit
at a time.
<i-pagination v-model="currentPage" quick-link :items="100" :items-per-page="10"></i-pagination>
export default {
data () {
return {
currentPage: 1
};
}
}
Component API
Here you can find a list of the various customization options you can use for the pagination component as props, as well as available slots and events.
Property items
Type Number
Default 0
Description Sets the total number of items to paginate.
Property items-per-page
Type Number
Default 20
Description Sets the number of items per pagination entry.
Property limit
Type Number
, Object
Accepted n % 2 === 1
Default { xs: 3, sm: 5 }
Description Sets the maximum number of pagination elements to display at a time.
Property quick-link
Type Boolean
Accepted true
, false
Default false
Description Enables pagination quick links.
Property size
Type String
Accepted sm
, md
, lg
Default md
Description Sets the size of the pagination component.
Property value
Type Number
Default 1
Description Sets the currently selected pagination entry.
Property variant
Type String
Accepted light
, dark
Default light
Description Sets the color variant of the pagination component.
Description Slot for pagination component default content.
Description Slot for pagination component next button content.
Description Slot for pagination component previous button content.
Event change
Type (item: Number) => {}
Description Emitted when active item changes.
Event input
Type (item: Number) => {}
Description Emitted when active item changes. Used together with v-model
.
Sass Variables
Here you can find a list of the Sass variables you can use for the pagination components. If you're looking to find common variables that these rely on, you should take a look at the Sass Variables page.
Property $pagination-font-size
Default $font-size
Property $pagination-item-disabled-color
Default $text-muted
Property $pagination-item-padding-base
Default $spacer-1-2 $spacer-1-3
Property $pagination-item-padding
Default size-map($pagination-item-padding-base, $sizes, $size-multipliers)
Property $pagination-item-min-width-base
Default 40px
Property $pagination-item-min-width
Default size-map($pagination-item-min-width-base, $sizes, $size-multipliers)
Property $pagination-item-spacing
Default 0.25rem
Property $pagination-item-border-width
Default $border-width
Property $pagination-item-border-radius
Default $border-radius
Property $pagination-item-background-active
Default $color-primary
Property $pagination-item-color-active
Default $color-white
Property $pagination-nav-disabled-opacity
Default 0.85
Property $pagination-color-for-light-variant
Default $color-for-light-variant
Property $pagination-color-for-dark-variant
Default $color-for-dark-variant
Property $pagination-variant-{variant}
Default pagination-variant($color-{variant})
Property $pagination-variants
Default (
light: $pagination-variant-light,
dark: $pagination-variant-dark
)
Function pagination-variant
Default @function pagination-variant($variant) {
$pagination-variant-color: variant-color-by-luminance($variant, $pagination-color-for-light-variant, $pagination-color-for-dark-variant);
$pagination-variant-color-disabled: variant-color-by-luminance($variant, darken-lightness($pagination-color-for-light-variant, 40%), lighten-lightness($pagination-color-for-dark-variant, 40%));
$pagination-variant-background: $variant;
$pagination-variant-background-hover: darken-lightness($variant, 10%);
$pagination-variant-border-color: variant-color-by-luminance($variant, $border-color-dark, $border-color-light);
$variant-map: (
color: $pagination-variant-color,
color-disabled: $pagination-variant-color-disabled,
background: $pagination-variant-background,
background-hover: $pagination-variant-background-hover,
border-color: $pagination-variant-border-color
);
@return $variant-map;
}