Skip to main content

Pagination

The Pagination component is used to display pagination in applications. It allows users to navigate between different pages of content, improving the user experience when browsing large amounts of data.

Basic use

This example presents the simplest pagination with default controls and page display.

Max pages

This example limits how many page links stay visible at once, making it easier to see how long paginations are condensed.

Round

This example changes the shape of pagination controls to a round variant, which alters the overall visual tone.

First, Last Buttons

This example focuses on the button-style pagination pattern where previous and next actions are visually dominant.

Show info

This example adds textual pagination state, such as the current page or result range, next to the controls.

When to use

Use wje-pagination when users need to enter values, choose options, or trigger form-related actions.

When not to use

Do not use it as a decorative element without interaction. Prefer presentational components in that case.

Accessibility

Always provide a label (label/aria-label), keep keyboard support, and surface clear validation feedback.

Best Practices

  • Keep validation rules and error behavior consistent across the entire form.
  • Show loading or disabled states during async operations.
  • Split complex forms into smaller sections with immediate feedback.

Attributes and Properties

hideEmpty

DescriptionControls whether hide-empty is enabled and affects component behavior.
Attributehide-empty
Typeboolean
Defaultfalse

maxPages

DescriptionSets the maximum number of pages. Updates the 'max-pages' attribute with the provided value.
Attributemax-pages
Typenumber|string
Default10

page

DescriptionRetrieves the current page number as a numeric value.
Attributepage
Typestring
Default0

pageSize

DescriptionSets the pageSize attribute to the specified value.
Attributepage-size
Typenumber|string
Default3

pageSizeOptions

DescriptionRetrieves the list of available page size options. This method is used to fetch the values representing the different page size options that can be provided or configured in a paginated component or system.
Attributepage-size-options
TypeArray<number>
Default-

round

DescriptionSets the 'round' attribute on the element. If the provided value is truthy, the 'round' attribute is added. If the value is falsy, the attribute is removed.
Attributeround
Typeboolean
Defaultfalse

showFirstButton

DescriptionSets the visibility of the first button based on the provided value. Adds the 'show-first-button' attribute when the value is truthy, and removes it otherwise.
Attributeshow-first-button
Typeboolean
Defaultfalse

showInfo

DescriptionSets the show-info attribute on the element based on the provided value.
Attributeshow-info
Typeboolean
Defaultfalse

showLastButton

DescriptionSets the visibility of the "last" button. This method controls the presence or absence of the "show-last-button" attribute based on the provided value.
Attributeshow-last-button
Typeboolean
Defaultfalse

showPageSizeOptions

DescriptionSets sizing for show-page-size-options.
Attributeshow-page-size-options
Typeboolean
Defaultfalse

totalItems

DescriptionSets the total number of items.
Attributetotal-items
Typenumber
Default0

Events

NameDescription
wje-pagination:page-changeEmitted when component state changes.

Methods

htmlPagination

DescriptionCreates a pagination control for navigating between pages of content. This method generates and returns a document fragment containing pagination controls, including buttons for navigating to the first, previous, next, and last pages, as well as optional informational text about the current set of displayed items and total number of items.
Signature() => DocumentFragment

htmlStackButtons

DescriptionCreates and returns a DocumentFragment containing a series of buttons for pagination purposes, based on the provided pagination object.
Signature(paginateObj: object) => DocumentFragment

CSS Shadow Parts

NameDescription
nativeThe wrapper element for the pagination component.

CSS Custom Properties

No CSS custom properties available for this component.

Slots

No slots available for this component.