Skip to content

Pagination

Pagination is used in tables to divide a large amount of data into several pages and serves as an alternative to lazy loading. Pagination inherits style and behavior from the checkbox button group.

Basic usage

Source code
vue
<script setup>
  import { AcvPagination } from '@acronis-platform/ui-component-library';
  import { ref } from 'vue';

  const currentPage = ref(1);
</script>

<template>
  <AcvPagination
    v-model="currentPage"
    :total="7"
    :limit="1"
  />
</template>

Examples

With router

...
...
Source code
vue
<script setup lang="ts">
  import { AcvPagination } from '@acronis-platform/ui-component-library';
  // TODO: fix example with vue-router
  // import { computed, getCurrentInstance } from 'vue';
  // import { createRouter, createWebHistory, useRoute } from 'vue-router';

  // const router = createRouter({
  //   history: createWebHistory(),
  //   routes: [
  //     {
  //       path: '/',
  //       component: {
  //         template: '<div>Test</div>',
  //       },
  //     },
  //   ],
  // });

  // const { app } = getCurrentInstance().appContext;
  // app.use(router);
  //
  // const route = useRoute();
  // // const router = useRouter();
  // const currentPage = computed(() => (route.query.page ? +route.query.page : 1));

  /**
   * Merge existing query with pagination params
   */
  // function getAcvPaginationQuery(query: LocationQueryRaw, page: number): LocationQueryRaw {
  //   // don't show first page in url
  //   return { ...query, page: page > 1 ? page : undefined };
  // }

  async function setActivePage() {
    // await router.push({ query: getAcvPaginationQuery(route.query, newPage) });
  }
</script>

<template>
  <AcvPagination
    :total="20"
    :limit="1"
    :model-value="currentPage"
    @update:model-value="setActivePage"
  />
</template>

Props

Prop nameDescriptionTypeValuesDefault
titleTitle of the Paginationstring-
descriptionDescription of the Paginationstring-

Events

Event namePropertiesDescription
closeeventName string - The name of the event
visible string - The visibility state of the component
Triggered when the component is closed

Slots

NameDescriptionBindings
defaultThe default slot content
descriptionThe description slot content

MIT Licensed