Usage
Use the default-page prop or the v-model:page directive to control the current page.
<script setup lang="ts">
const page = ref(5)
</script>
<template>
<B24Pagination v-model:page="page" :total="100" />
</template>
Button to display the pages, use color and size props to style them.Total
Use the total prop to set the total number of items in the list.
<script setup lang="ts">
const page = ref(5)
</script>
<template>
<B24Pagination v-model:page="page" :total="100" />
</template>
Items Per Page
Use the items-per-page prop to set the number of items per page. Defaults to 10.
<script setup lang="ts">
const page = ref(5)
</script>
<template>
<B24Pagination v-model:page="page" :items-per-page="20" :total="100" />
</template>
Sibling Count
Use the sibling-count prop to set the number of siblings to show. Defaults to 2.
<script setup lang="ts">
const page = ref(5)
</script>
<template>
<B24Pagination v-model:page="page" :sibling-count="1" :total="100" />
</template>
Show Edges
Use the show-edges prop to always show the ellipsis, first and last pages. Defaults to false.
<script setup lang="ts">
const page = ref(5)
</script>
<template>
<B24Pagination v-model:page="page" show-edges :sibling-count="1" :total="100" />
</template>
Show Controls
Use the show-controls prop to show the first, prev, next and last buttons. Defaults to true.
<script setup lang="ts">
const page = ref(5)
</script>
<template>
<B24Pagination v-model:page="page" :show-controls="false" show-edges :total="100" />
</template>
Color
Use the color prop to set the color of the inactive controls. Defaults to air-secondary-no-accent.
<script setup lang="ts">
const page = ref(5)
</script>
<template>
<B24Pagination v-model:page="page" color="air-tertiary-no-accent" :total="100" />
</template>
Active Color
Use the active-color prop to set the color of the active control. Defaults to air-primary.
<script setup lang="ts">
const page = ref(5)
</script>
<template>
<B24Pagination v-model:page="page" active-color="air-primary-copilot" :total="100" />
</template>
Size
Use the size prop to set the size of the controls. Defaults to md.
<script setup lang="ts">
const page = ref(5)
</script>
<template>
<B24Pagination v-model:page="page" size="xl" :total="100" />
</template>
Disabled
Use the disabled prop to disable the pagination controls.
<script setup lang="ts">
const page = ref(5)
</script>
<template>
<B24Pagination v-model:page="page" :total="100" disabled />
</template>
Examples
With links
Use the to prop to transform buttons into links. Pass a function that receives the page number and returns a route destination.
#with-links hash to avoid going to the top of the page.API
Props
Slots
Emits
Theme
export default defineAppConfig({
b24ui: {
pagination: {
slots: {
root: '',
list: 'flex items-center gap-1',
ellipsis: 'pointer-events-none',
label: 'text-center',
first: '',
prev: '',
item: '',
next: '',
last: ''
}
}
}
})
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import bitrix24UIPluginVite from '@bitrix24/b24ui-nuxt/vite'
export default defineConfig({
plugins: [
vue(),
bitrix24UIPluginVite({
b24ui: {
pagination: {
slots: {
root: '',
list: 'flex items-center gap-1',
ellipsis: 'pointer-events-none',
label: 'text-center',
first: '',
prev: '',
item: '',
next: '',
last: ''
}
}
}
})
]
})