Skip to content
All components
Navigation

Pagination

Let people move between the pages of a long, ordered collection with real links, while showing which page they are on.

Page links that reuse the button variants.

Installation

tdpxl is not an npm dependency of your app. The @tdpxl/cli command (not published to npm yet) copies the source into your project, with the registry items and npm packages it imports.

npx @tdpxl/cli add pagination

Then import it from @/components/ui/pagination. New project? Start with the installation guide.

Examples

Each example is one branch of the official demo, rendered in its own frame. The code is that branch as you would write it, with imports pointing at the default install paths.

Controlled boundaries

Let the parent own the current page and disable the first and last boundary links. Boundary links combine aria-disabled, tabIndex -1 and a cancelled click, because aria-disabled alone does not stop an anchor.

"use client"

import * as React from "react"

import {
  Pagination,
  PaginationContent,
  PaginationItem,
  PaginationLink,
  PaginationNext,
  PaginationPrevious,
} from "@/components/ui/pagination"

const TOTAL_PAGES = 5

export function PaginationControlledBoundaries() {
  // Page state belongs to the consumer (usually the router or a query param).
  const [page, setPage] = React.useState(1)
  const isFirst = page === 1
  const isLast = page === TOTAL_PAGES

  function goTo(event: React.MouseEvent<HTMLAnchorElement>, target: number) {
    // Stand-in for client-side routing; a real app lets the router handle the href.
    event.preventDefault()
    if (target < 1 || target > TOTAL_PAGES) return
    setPage(target)
  }

  return (
    <div className="flex w-full flex-col gap-8">
      <Pagination aria-label="Invoice pages">
        <PaginationContent>
          <PaginationItem>
            <PaginationPrevious
              href={`#page-${Math.max(1, page - 1)}`}
              aria-disabled={isFirst || undefined}
              tabIndex={isFirst ? -1 : undefined}
              className="transition-none aria-disabled:pointer-events-none aria-disabled:text-disabled-300"
              onClick={(event) => goTo(event, page - 1)}
            />
          </PaginationItem>
          {Array.from({ length: TOTAL_PAGES }, (_, index) => index + 1).map((value) => (
            <PaginationItem key={value}>
              <PaginationLink
                href={`#page-${value}`}
                aria-label={`Page ${value}`}
                isActive={page === value}
                onClick={(event) => goTo(event, value)}
              >
                {value}
              </PaginationLink>
            </PaginationItem>
          ))}
          <PaginationItem>
            <PaginationNext
              href={`#page-${Math.min(TOTAL_PAGES, page + 1)}`}
              aria-disabled={isLast || undefined}
              tabIndex={isLast ? -1 : undefined}
              className="transition-none aria-disabled:pointer-events-none aria-disabled:text-disabled-300"
              onClick={(event) => goTo(event, page + 1)}
            />
          </PaginationItem>
        </PaginationContent>
      </Pagination>
    </div>
  )
}

Windowed range

Show the first, last and neighbouring pages of a long range around the current page. The ellipsis is decorative; every page a user needs is a real link.

"use client"

import * as React from "react"

import {
  Pagination,
  PaginationContent,
  PaginationEllipsis,
  PaginationItem,
  PaginationLink,
  PaginationNext,
  PaginationPrevious,
} from "@/components/ui/pagination"

const TOTAL_PAGES = 5

export function PaginationWindowedRange() {
  // Page state belongs to the consumer (usually the router or a query param).
  const [page, setPage] = React.useState(1)
  
  

  function goTo(event: React.MouseEvent<HTMLAnchorElement>, target: number) {
    // Stand-in for client-side routing; a real app lets the router handle the href.
    event.preventDefault()
    if (target < 1 || target > TOTAL_PAGES) return
    setPage(target)
  }

  return (
    <div className="flex w-full flex-col gap-8">
      <Pagination aria-label="Search results pages">
        <PaginationContent>
          <PaginationItem>
            <PaginationPrevious href="#" />
          </PaginationItem>
          <PaginationItem>
            <PaginationLink href="#" aria-label="Page 1">
              1
            </PaginationLink>
          </PaginationItem>
          <PaginationItem>
            <PaginationEllipsis />
          </PaginationItem>
          <PaginationItem>
            <PaginationLink href="#" aria-label="Page 9">
              9
            </PaginationLink>
          </PaginationItem>
          <PaginationItem>
            <PaginationLink href="#" aria-label="Page 10" isActive>
              10
            </PaginationLink>
          </PaginationItem>
          <PaginationItem>
            <PaginationLink href="#" aria-label="Page 11">
              11
            </PaginationLink>
          </PaginationItem>
          <PaginationItem>
            <PaginationEllipsis />
          </PaginationItem>
          <PaginationItem>
            <PaginationLink href="#" aria-label="Page 20">
              20
            </PaginationLink>
          </PaginationItem>
          <PaginationItem>
            <PaginationNext href="#" />
          </PaginationItem>
        </PaginationContent>
      </Pagination>
    </div>
  )
}

Compact mobile

Reduce pagination to previous, next and a page count for narrow screens. The count is plain text; the two links keep their accessible names when their labels hide.

"use client"

import * as React from "react"

import {
  Pagination,
  PaginationContent,
  PaginationItem,
  PaginationNext,
  PaginationPrevious,
} from "@/components/ui/pagination"

const TOTAL_PAGES = 5

export function PaginationCompactMobile() {
  // Page state belongs to the consumer (usually the router or a query param).
  const [page, setPage] = React.useState(1)
  
  

  function goTo(event: React.MouseEvent<HTMLAnchorElement>, target: number) {
    // Stand-in for client-side routing; a real app lets the router handle the href.
    event.preventDefault()
    if (target < 1 || target > TOTAL_PAGES) return
    setPage(target)
  }

  return (
    <div className="flex w-full flex-col gap-8">
      <Pagination aria-label="Order history pages">
        <PaginationContent className="w-full max-w-sm justify-between">
          <PaginationItem>
            <PaginationPrevious href="#" />
          </PaginationItem>
          <PaginationItem className="text-paragraph-sm text-sub-600">
            Page 3 of 12
          </PaginationItem>
          <PaginationItem>
            <PaginationNext href="#" />
          </PaginationItem>
        </PaginationContent>
      </Pagination>
    </div>
  )
}

Custom labels

Replace the previous and next labels with content-specific wording. The accessible name is overridden together with the visible label so both stay in sync.

"use client"

import * as React from "react"

import {
  Pagination,
  PaginationContent,
  PaginationItem,
  PaginationNext,
  PaginationPrevious,
} from "@/components/ui/pagination"

const TOTAL_PAGES = 5

export function PaginationCustomLabels() {
  // Page state belongs to the consumer (usually the router or a query param).
  const [page, setPage] = React.useState(1)
  
  

  function goTo(event: React.MouseEvent<HTMLAnchorElement>, target: number) {
    // Stand-in for client-side routing; a real app lets the router handle the href.
    event.preventDefault()
    if (target < 1 || target > TOTAL_PAGES) return
    setPage(target)
  }

  return (
    <div className="flex w-full flex-col gap-8">
      <Pagination aria-label="Post navigation">
        <PaginationContent>
          <PaginationItem>
            <PaginationPrevious href="#" aria-label="Go to newer posts">
              Newer posts
            </PaginationPrevious>
          </PaginationItem>
          <PaginationItem>
            <PaginationNext href="#" aria-label="Go to older posts">
              Older posts
            </PaginationNext>
          </PaginationItem>
        </PaginationContent>
      </Pagination>
    </div>
  )
}

API reference

Generated from the component's TypeScript signatures. Inherited DOM and primitive props are listed separately.

Pagination

Navigate between pages of a paged collection.

Pagination props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (13)
Pagination inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

PaginationContent

Content region within the root composition. Keep required providers, labels and related controls from the complete example.

PaginationContent props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (13)
PaginationContent inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLUListElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLUListElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLUListElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLUListElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLUListElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLUListElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLUListElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

PaginationEllipsis

Decorative marker for skipped pages. It is hidden from assistive technology and is not an overflow button; the surrounding page links carry the real destinations, so link the pages users need to reach directly.

PaginationEllipsis props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (13)
PaginationEllipsis inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLSpanElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLSpanElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLSpanElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLSpanElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLSpanElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLSpanElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLSpanElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

PaginationItem

One item within its parent composition. Keep parent context and the value, label or state required by the source API.

PaginationItem props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (14)
PaginationItem inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLLIElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
valuestring | number | readonly string[] | undefined—Current value in the shape defined by the source type. For controlled interactive inputs, apply updates from the change callback.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLLIElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLLIElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLLIElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLLIElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLLIElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLLIElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

PaginationLink

The PaginationLink part of pagination. Use it with the complete source composition and preserve its required parent context.

PaginationLink props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
isActiveboolean | undefined—Mark this item as the current destination or active item. Keep its state consistent with the consuming application's actual selection.
size"xs" | "sm" | "md" | "lg" | undefined"sm"Button size used by the pagination link. Preserve link semantics and a usable target.
Inherited props (14)
PaginationLink inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLAnchorElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
typestring | undefined—Native element or primitive mode defined by the source union. Choose a supported value; its meaning depends on the component.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLAnchorElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLAnchorElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLAnchorElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLAnchorElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLAnchorElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLAnchorElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

PaginationNext

The PaginationNext part of pagination. Use it with the complete source composition and preserve its required parent context.

PaginationNext props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
isActiveboolean | undefined—Mark this item as the current destination or active item. Keep its state consistent with the consuming application's actual selection.
size"xs" | "sm" | "md" | "lg" | undefined—Button size used by the pagination link. Preserve link semantics and a usable target.
Inherited props (14)
PaginationNext inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLAnchorElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
typestring | undefined—Native element or primitive mode defined by the source union. Choose a supported value; its meaning depends on the component.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLAnchorElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLAnchorElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLAnchorElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLAnchorElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLAnchorElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLAnchorElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

PaginationPrevious

The PaginationPrevious part of pagination. Use it with the complete source composition and preserve its required parent context.

PaginationPrevious props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
isActiveboolean | undefined—Mark this item as the current destination or active item. Keep its state consistent with the consuming application's actual selection.
size"xs" | "sm" | "md" | "lg" | undefined—Button size used by the pagination link. Preserve link semantics and a usable target.
Inherited props (14)
PaginationPrevious inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLAnchorElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
typestring | undefined—Native element or primitive mode defined by the source union. Choose a supported value; its meaning depends on the component.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLAnchorElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLAnchorElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLAnchorElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLAnchorElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLAnchorElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLAnchorElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

Accessibility & usage

From registry/ui/pagination.meta.json (authored guidance; human review may still be pending). Behavior is checked by Storybook tests, not certified here.

When to use

  • Results, tables or archives split into numbered pages where people benefit from knowing their position and jumping to a specific page.
  • Content whose pages have their own URL, so a page can be bookmarked, shared and reached again with the browser's back button.
  • Previous and next navigation between sequential items such as articles or posts, with labels that describe the direction ('Older posts').

When not to use

  • Switching between peer panels of the same view; that is tabs.
  • Feeds where position does not matter and people mostly browse; consider a 'Load more' button or infinite scrolling with a reachable footer.
  • Steps of a form or wizard, where moving on requires validation; use explicit Back and Continue buttons.
  • Very small collections (one or two pages) that fit on one page.

Anatomy

Pagination
nav landmark with a default aria-label of 'pagination'; pass aria-label to name it after the content ('Search results pages'), especially when a page has more than one.
PaginationContent
The list (ul) that holds the items in reading order.
PaginationItem
One list item; it can also hold plain text such as 'Page 3 of 12'.
PaginationLink
A native anchor styled like a button. isActive sets aria-current='page' and the current-page appearance; size picks the button size (default sm).
PaginationPrevious / PaginationNext
PaginationLink with a chevron, a default accessible name ('Go to previous page' / 'Go to next page') and a visible label that hides below the sm breakpoint. children replaces the label; aria-label replaces the name.
PaginationEllipsis
Decorative marker for skipped pages, aria-hidden; not focusable or operable.

Keyboard & interaction

  • Every page is a real link: Tab moves between them in reading order and Enter follows the link. There is no arrow-key roving focus, because this is a list of links, not a composite widget.
  • The consumer owns navigation: hrefs, routing or fetching, total pages and what happens at the first and last page. Clicking a link changes nothing by itself.
  • After navigating, keep the experience predictable (WCAG 3.2): either load a new page, or update the list in place and move focus to the top of the results or announce the new page, so keyboard and screen-reader users are not left at the bottom.
  • Boundary links that cannot be used must be inert, not just look inert: aria-disabled, tabIndex={-1} and a cancelled click together, or remove the link.
  • The current page link carries aria-current='page', so it is announced as the current page, not only shown with a different style.

Responsive behavior

  • Below the sm breakpoint the Previous and Next labels hide and only the chevrons remain; their accessible names stay, so keep them meaningful.
  • At narrow widths show fewer numbers: first, last, current and its neighbours with ellipses, or reduce to Previous, 'Page n of m' and Next. Never let the list overflow horizontally at 320 CSS px (WCAG 1.4.10).
  • Keep links at least 24x24 CSS px with clear spacing (WCAG 2.5.8); prefer a larger size on touch-first layouts, since page numbers sit close together.
  • Repeat pagination above long result lists only when people need it there; one control below the list is usually enough.

Content guidelines

  • Name the landmark after what it pages: 'Search results pages', 'Invoice pages'. Use a unique name for each pagination on a page.
  • Give numeric links a name with context when the number alone is ambiguous, such as 'Page 4'; keep the visible number inside the accessible name (WCAG 2.5.3).
  • Use direction words that match the content: 'Previous' and 'Next' for ordered results, 'Newer posts' and 'Older posts' for chronological lists. When you change the visible label, change aria-label to match.
  • Show the total when it is known ('Page 3 of 12'); avoid showing a total you cannot guarantee.

Alternatives

  • Tabs — Peer panels of one view, switched in place without a page change.
  • Button — A single 'Load more' action that appends items to the current list.
  • Breadcrumb — Showing where a page sits in a hierarchy rather than its position in a sequence.

Resources