WlPagination

Pagination with page numbers and ellipses. Compact mode enters the page number in an input.
Components / Data v0.1.0

Change props to see the result: the example and code use the same settings. “Reset” restores the initial values.

Settings

pageCount

Total pages.

siblings

Number of pages shown around the current page.

pageSize
Not set

Number of rows displayed on a page.

total
Not set

Total number of data rows used to calculate pagination.

Compact view with an input.

Disables navigation.

Props page, pt, pageSizes, models, handlers and slots can be edited in the SFC. See their descriptions in API.

Example

Page 1 of 12

Focus: outside the example · pointer: outside the example

Explore the live example and copy its Vue SFC into your application. Settings on the left can be combined.

Code for your application

Vue SFC · current settings
<script setup lang="ts">
import { WlPagination } from "legato-ui";
import { ref } from "vue";
const page = ref(1);
</script>

<template>
  <div class="wl-stack" data-space="md">
    <WlPagination v-model:page="page" :page-count="12"  />
    <p class="wl-text-small" role="status">{{ "Page" }} {{ page }} {{ "of 12" }}</p>
  </div>
</template>

Page list and compact input

Ellipses, two named navigation regions, Enter/blur for compact page numbers and disabled.

Default: 6 of 12. Compact: 2 of 9.

The compact field applies the page number on Enter or blur. The value is clamped to the available range.

Vue SFC · additional example
<script setup lang="ts">
import { WlCheckbox, WlPagination } from "legato-ui";
import { ref } from "vue";
const page = ref(6);
const compactPage = ref(2);
const disabled = ref(false);
</script>

<template>
  <div class="wl-stack" data-space="lg">
    <WlCheckbox v-model="disabled">{{ "Disable page navigation" }}</WlCheckbox>
    <WlPagination
      v-model:page="page"
      :page-count="12"
      :siblings="1"
      :disabled="disabled"
      :pt="{ root: { 'aria-label': 'Material pages' } }"
    />
    <WlPagination
      v-model:page="compactPage"
      :page-count="9"
      compact
      :disabled="disabled"
      :pt="{ root: { 'aria-label': 'Compact material pages' } }"
    />
    <p class="wl-text-small" role="status">
      {{ "Default:" }} {{ page }} {{ "of 12. Compact:" }}
      {{ compactPage }} {{ "of 9." }}
    </p>
    <p class="wl-text-small wl-text-muted">{{ "The compact field applies the page number on Enter or blur. The value is clamped to the available range." }}</p>
  </div>
</template>