Skip to content

Pagination

A long list can be divided into several pages using Pagination, and only one page will be loaded at a time.

When To Use

  • When it will take a long time to load/render all items.
  • If you want to browse the data by navigating through pages.

Examples

Basic

vue
<template>
  <a-pagination v-model:current="current" :total="50" />
</template>

<script setup>
import { ref } from 'vue'

const current = ref(1)
</script>

More

vue
<template>
  <div>
    <a-pagination
      v-model:current="current1"
      :total="50"
      show-size-changer
      :page-size-options="['10', '20', '50', '100']"
      :show-total="(total, range) => `${range[0]}-${range[1]} of ${total} items`"
    />
    <br />
    <a-pagination
      v-model:current="current2"
      :total="500"
      show-size-changer
      :page-size-options="['10', '20', '50', '100']"
      :show-total="(total, range) => `${range[0]}-${range[1]} of ${total} items`"
    />
  </div>
</template>

<script setup>
import { ref } from 'vue'

const current1 = ref(1)
const current2 = ref(1)
</script>

Changer

vue
<template>
  <div>
    <a-pagination
      :current="1"
      :total="50"
      :show-total="(total, range) => `${range[0]}-${range[1]} of ${total} items`"
      :page-size="20"
      :default-current="1"
    />
    <br />
    <a-pagination
      :current="1"
      :total="50"
      size="small"
      :show-total="(total, range) => `${range[0]}-${range[1]} of ${total} items`"
      :page-size="20"
      :show-size-changer="false"
    />
    <br />
    <a-pagination
      :current="1"
      :total="50"
      :show-total="(total, range) => `${range[0]}-${range[1]} of ${total} items`"
      :page-size="20"
      disabled
    />
  </div>
</template>

Jump

vue
<template>
  <div>
    <a-pagination
      :current="1"
      :total="50"
      show-quick-jumper
      :show-total="(total, range) => `${range[0]}-${range[1]} of ${total} items`"
    />
    <br />
    <a-pagination
      :current="1"
      :total="50"
      show-quick-jumper
      show-size-changer
      :show-total="(total, range) => `${range[0]}-${range[1]} of ${total} items`"
    />
  </div>
</template>

Mini size

vue
<template>
  <div>
    <a-pagination size="small" :current="1" :total="50" />
    <br />
    <a-pagination
      size="small"
      :current="1"
      :total="50"
      show-size-changer
      show-quick-jumper
    />
    <br />
    <a-pagination
      size="small"
      :current="1"
      :total="50"
      :show-total="(total, range) => `${range[0]}-${range[1]} of ${total} items`"
    />
  </div>
</template>

Simple mode

vue
<template>
  <div>
    <a-pagination simple :current="1" :total="50" />
    <br />
    <a-pagination
      simple
      :current="1"
      :total="50"
      :show-total="(total, range) => `Total ${total} items`"
    />
  </div>
</template>

API

html
<a-pagination
  :current="1"
  :total="50"
  :page-size="10"
  :page-size-options="['10', '20', '50', '100']"
/>
PropertyDescriptionTypeDefaultVersion
current (v-model)Current page numbernumber-
defaultCurrentDefault initial page numbernumber1
defaultPageSizeDefault number of data items per pagenumber10
disabledDisable paginationboolean-
hideOnSinglePageWhether to hide pager on single pagebooleanfalse
itemRenderTo customize item innerHTML(page, type: 'page' | 'prev' | 'next', originalElement) => vNode | v-slot-
pageSize (v-model)Number of data items per pagenumber-
pageSizeOptionsSpecify the sizeChanger optionsstring[] | number[]['10', '20', '50', '100']
responsiveIf size is not specified, Pagination would resize according to the window widthboolean-
showLessItemsShow less page itemsbooleanfalse
showQuickJumperDetermine whether you can jump to pages directlyboolean | objectfalse
showSizeChangerDetermine whether to show pageSize select, it will be true when total > 50boolean-
showTitleShow page item's titlebooleantrue
showTotalTo display the total number and rangefunction(total, range)-
simpleWhether to use simple modeboolean-
sizeSpecify the size of Pagination, can be set to smallstring-
totalTotal number of data itemsnumber0

Events

Events NameDescriptionArgumentsVersion
changeCalled when the page number or pageSize is changed, and it takes the resulting page number and pageSize as its argumentsfunction(page, pageSize)-
showSizeChangeCalled when pageSize is changedfunction(current, size)-

Released under the MIT License.