Skip to content

Pagination

Pagination

Page navigation for paged content: page buttons with ellipses, optional Previous/Next and First/Last buttons, inside a <nav> landmark named "Pagination" (override with aria-label).

onPageChange is an event callback: it fires on every activation, including the current page. Boundary buttons that point at the current page use aria-disabled and keep focus; the whole control is disabled with disabled. Button names are localized with getItemAriaLabel.

Examples

Default

export const Default: Story = {};

Many Pages

export const ManyPages: Story = {
  args: {
    totalPages: 50,
    defaultCurrentPage: 25,
  },
};

Small Size

export const SmallSize: Story = {
  args: {
    size: 'small',
  },
};

With First Last

export const WithFirstLast: Story = {
  args: {
    totalPages: 20,
    showFirstLast: true,
    defaultCurrentPage: 10,
  },
};

Disabled

export const Disabled: Story = {
  args: {
    disabled: true,
    defaultCurrentPage: 3,
  },
};

Localized

export const Localized: Story = {
  args: {
    'aria-label': 'Sidenavigasjon',
    lang: 'nb',
    showFirstLast: true,
    getItemAriaLabel: norwegianLabels,
  },
};

Controlled

Current page: 3

export const Controlled: Story = {
  render: ({ onPageChange, ...args }) => {
    const [page, setPage] = React.useState(3);
    return (
      <div className="flex flex-col gap-4">
        <Pagination
          currentPage={page}
          onPageChange={(next) => {
            setPage(next);
            onPageChange?.(next);
          }}
          {...args}
        />
        <p className="text-wave-body-1">Current page: {page}</p>
      </div>
    );
  },
};

Props

NameTypeRequiredDefaultDescription
currentPagenumberNo

Controlled current page number (1-based). A value outside 1…totalPages is shown clamped, and onPageChange is called once with the clamped page so the parent can resync. The prop stays authoritative: if the parent keeps the old value, it is shown again once it is back in range.

defaultCurrentPagenumberNo1

Default current page for uncontrolled usage. When the current page falls outside 1…totalPages (for example because totalPages shrinks), the clamped page is kept and reported once through onPageChange; it does not jump back when totalPages grows again.

totalPagesnumberYes

Total number of pages. A fractional value is rounded down; 0, a negative value or NaN renders nothing (non-integer values log a development warning).

onPageChange(page: number) => voidNo

Called with the target page whenever a page, First, Previous, Next or Last button is activated — also when the current page is activated again (0.4 semantics) — and once when the current page is clamped into 1…totalPages.

siblingCountnumberNo1

Number of page buttons to show on each side of the current page.

boundaryCountnumberNo1

Number of page buttons to always show at the start and end. With 0 no page is pinned there, and an ellipsis marks the pages before or after the shown range.

showPreviousNextbooleanNotrue

Whether to show previous/next navigation buttons.

showFirstLastbooleanNofalse

Whether to show first/last page navigation buttons.

disabledbooleanNofalse

Whether the entire pagination control is disabled (every button gets the native disabled attribute). Boundary buttons that point at the current page are not natively disabled: they use aria-disabled="true" and stay focusable.

size'small' | 'medium'No'medium'

Size of the pagination buttons.

getItemAriaLabel(type: PaginationItemType, page: number, selected: boolean) => stringNo

Accessible name of each button, for localization. page is the page the button navigates to (for 'page' items, the page it shows); selected is true for the current page. Defaults: 'First page', 'Previous page', Page ${page} , 'Next page', 'Last page'. The landmark itself is named with aria-label (default 'Pagination') or aria-labelledby.

refReact.Ref<HTMLElement>No

Ref to the root <nav> element.

slotProps{ list?: SlotPart<'ol'>; listItem?: SlotPart<'li'>; firstButton?: SlotPart<'button'>; previousButton?: SlotPart<'button'>; pageButton?: SlotPart<'button'>; nextButton?: SlotPart<'button'>; lastButton?: SlotPart<'button'>; ellipsis?: SlotPart<'span'> }No

Props for the elements the control draws inside its landmark, by part, merged into each part's own: your classes after the part's (yours win a conflict), your styles over its styles, your attributes and handlers added, your ref attached. Every attribute the control sets on a part is locked, and no part takes another role or hides what it holds. A part takes no children (the control draws their content). On a button your handler runs before the button's own: preventDefault() in yours skips the page change, onPageChange included. The list and the list items receive the buttons' events after them. Fluent UI has no Pagination.

Any other prop is passed to the element it renders (HTMLElement).

Parts

  • list
  • listItem
  • firstButton
  • previousButton
  • pageButton
  • nextButton
  • lastButton
  • ellipsis

Stable class names

PartClass
rootwave-pagination
listwave-pagination__list
listItemwave-pagination__list-item
firstButtonwave-pagination__first-button
previousButtonwave-pagination__previous-button
pageButtonwave-pagination__page-button
nextButtonwave-pagination__next-button
lastButtonwave-pagination__last-button
ellipsiswave-pagination__ellipsis