Create

Navigation

Pagination

Copy page View as Markdown Open in ChatGPT Open in Claude

Pagination with page navigation, next and previous links.

Usage#

app.component.ts
import { WDS_PAGINATION } from '@wds/angular/pagination';

Examples#

Default#

Custom content (wds-pagination-content with items) replaces the generated buttons. With href the buttons are links, e.g. for pages rendered on the server; active marks the current page.

Previous 1 2 3 Next

Automatic#

Without content the element renders the pages from total itself, changes page on a click and fires wds-change. The texts it renders are built-in and currently in Polish; for another language use custom content, as in the other examples.

Page 3 of 7

Simple#

simple shows the page numbers without the arrows.

Previous and next#

Only the arrows, with the page number next to them. The text of the arrows hides on narrow screens; the label stays their accessible name.

Page 1 of 14PreviousNext

Rows per page#

A wds-select sets the page size, e.g. under a table. The number of pages follows from the page size, and the current page stays within range when there are fewer pages. Between the arrows a window of three pages follows the current one.

Page 1 of 14 Previous123NextRows per page102550100

API References#

wds-pagination#

Pagination: previous page, page numbers and next page. Without content it renders buttons for pages 1…total itself and changes page on selection (wds-change event). Custom content (wds-pagination-content with items) replaces the generated list; then the app handles the clicks.

Attributes

AttributeTypeDefaultDescription
pagenumber1The current page (from 1).
totalnumber1Number of pages.
simplebooleanfalsePage numbers only, without arrows.
disabledbooleanfalseDisables every button.
sizeWdsPaginationSize'icon'Size of the page buttons; the arrows get the matching text size.
labelstring'Paginacja'Group label for screen readers.

Events

EventDescription
wds-changeCustomEvent<WdsPaginationChangeDetail>The user selected another page.

Slots

SlotDescription
(default)Custom pagination structure (instead of the generated one).

wds-pagination-content#

The list of pagination items (role="list").

Slots

SlotDescription
(default)wds-pagination-item elements.

wds-pagination-item#

An item of the pagination list (role="listitem"): a button, an arrow or an ellipsis.

Slots

SlotDescription
(default)Item content.

wds-pagination-button#

A page button. The active page has the outline variant and aria-current="page", the others ghost. With href it renders a link.

Attributes

AttributeTypeDefaultDescription
activebooleanfalseThe current page.
disabledbooleanfalseDisables the button.
sizeWdsPaginationSize'icon'Button size.
hrefstring | undefinedPage URL: the button becomes a link.
labelstring | undefinedAccessible name (e.g. "Page 3").

Slots

SlotDescription
(default)Page number.

CSS parts (::part)

PartDescription
buttonThe native <button> or <a>.

wds-pagination-previous#

Previous page button: an arrow and text (hidden on narrow screens).

Attributes

AttributeTypeDefaultDescription
labelstring'Poprzednia strona'Accessible name.
disabledbooleanfalseDisables the button (e.g. on the first or last page).
sizeWdsPaginationNavSize'default'Button size.
hrefstring | undefinedPage URL: the button becomes a link.

Slots

SlotDescription
(default)Text (default Poprzednia).

CSS parts (::part)

PartDescription
buttonThe native <button> or <a>.

wds-pagination-next#

Next page button: text (hidden on narrow screens) and an arrow.

Attributes

AttributeTypeDefaultDescription
labelstring'Następna strona'Accessible name.
disabledbooleanfalseDisables the button (e.g. on the first or last page).
sizeWdsPaginationNavSize'default'Button size.
hrefstring | undefinedPage URL: the button becomes a link.

Slots

SlotDescription
(default)Text (default Następna).

CSS parts (::part)

PartDescription
buttonThe native <button> or <a>.

wds-pagination-ellipsis#

An ellipsis in place of skipped pages. Hidden from screen readers.

Accessibility#

Screen reader#

wds-pagination has role="group" named by label (default Paginacja); the items form a list. When the pagination is the main navigation of a page, wrap it in <nav aria-label="…">.

The current page has aria-current="page". Page buttons are named by their label; in automatic mode they get fixed names in Polish (Strona 3, Ostatnia strona, 7), so for English pages render custom content with your own labels.

The arrows are named by label (default Poprzednia strona / Następna strona); their text and icon are hidden from screen readers. The ellipsis is hidden too.

Keyboard support#

KeyFunction
TabMoves focus to the next page button or arrow. Disabled arrows are skipped.
EnterOpens the page (button or link).
SpaceOpens the page of a button (links open only with Enter).
Footer