OYNA

Pagination ​

The way through a list too long for one screen: a row of page numbers with arrows at its ends.

VersionWhenBy
v1.4.22 h agoada
v1.4.12 days agograce
v1.4.03 days agolinus
v1.3.94 days agoada
v1.3.85 days agograce
vue
<script setup lang="ts">
import { computed, ref } from 'vue'

const page = ref(1)
const size = 5
const rows = computed(() => deploys.slice((page.value - 1) * size, page.value * size))
</script>

<template>
  <OTable :columns="columns" :rows="rows" row-key="version" />
  <OPagination v-model:page="page" :total="deploys.length" :page-size="size" />
</template>

It takes total, the number of items, not of pages, and works the pages out from page-size. It does not cut the list: show the rows of the current page yourself, as above, or ask the server for them.

Many pages ​

The first and the last page are always shown; the far ones fold into a gap. siblings is how many pages stand on each side of the current one.

vue
<OPagination v-model:page="page" :total="200" />
<OPagination v-model:page="page" :total="200" :siblings="2" />

Disabled ​

vue
<OPagination :total="50" disabled />

Props ​

PropTypeDefaultDescription
totalnumberrequiredHow many items there are in all
v-model:pagenumber1The current page, from 1
pageSizenumber10Items on one page
siblingsnumber1Pages on each side of the current one
disabledbooleanfalse
labelstring'Pages'What a screen reader calls it; make it differ if a page has two
prevLabelstring'Previous page'Name of the left arrow
nextLabelstring'Next page'Name of the right arrow

Built on Reka UI Pagination.