On this page

Pagination

Install, props and the parts Pagination is built from.

Install

Run this in the app, after shadcn-vue init and the Beehexa theme (Button › Code):

npx shadcn-vue@latest add https://beehexa.design/r/pagination.json

Use

<script setup lang="ts">
import { ref } from 'vue'
import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationNext, PaginationPrevious } from '@/components/ui/pagination'
const page = ref(1)
</script>

<template>
  <div>
    <Pagination v-slot="{ page: current }" v-model:page="page" :total="312" :items-per-page="20">
      <PaginationContent v-slot="{ items }">
        <PaginationPrevious />
        <template v-for="(item, i) in items" :key="i">
          <PaginationItem v-if="item.type === 'page'" :value="item.value" :is-active="item.value === current">{{ item.value }}</PaginationItem>
          <PaginationEllipsis v-else :index="i" />
        </template>
        <PaginationNext />
      </PaginationContent>
    </Pagination>
  </div>
</template>

Props

Part Prop Values Notes
Pagination v-model:page, total, items-per-page, sibling-count number

Built on

reka-ui PaginationRoot, as the shadcn-vue Pagination; the buttons are Beehexa Buttons.