Skip to main content Home About the Design SystemRoadmap OverviewDesignersDevelopers OverviewColorGridIconographyInteractionsSpacingTypography Overview Global colorBox shadowTypographyBorderOpacitySpaceLengthIconBreakpointsMedia queries All elements Accordion Alert Announcement Audio player Avatar Back to top Badge Blockquote Breadcrumb Button Card Chip Code block Call to action Dialog Disclosure Footer Health index Icon Jump links Menu dropdown Navigation link Navigation (primary) Navigation (secondary) Navigation (vertical) Pagination PopoverPlanned Progress stepper Scheme toggle Site status Skeleton Skip link Spinner Statistic Subnavigation Surface Switch Table Tabs Tag Tile Timestamp Tooltip Video embed OverviewColor PalettesCustomizingDevelopers All PatternsAccordionCall to ActionCardFilterFormLink with iconLogo wallSearch barSticky bannerSticky cardTabsTagTile All Personalization PatternsAnnouncement FundamentalsAccessibility toolsAssistive technologiesCI/CDContentContributorsDesignDevelopmentManual testingResourcesScreen readers Design/code status Release notes Get support

Pagination

OverviewStyleGuidelinesCodeAccessibilityDemos
ImportingUsageImplementation guidelinesrh-paginationImportingUsageImplementation guidelinesrh-pagination

Importing

Add rh-pagination to your page with this import statement:

<script type="module">
  import '@rhds/elements/rh-pagination/rh-pagination.js';
</script>
Copy to Clipboard Wrap lines

To learn more about installing RHDS elements on your site using an import map read our getting started docs.

Lightdom CSS

This element requires you to load "Lightdom CSS" stylesheets for styling deeply slotted elements.

Note

Replace /path/to/ with path to the CSS file, whether local or CDN.

<link rel="stylesheet" href="/path/to/rh-pagination/rh-pagination-lightdom.css">

Usage

<meta itemprop="description" content="Default pagination with page links and numeric input.">
<rh-pagination>
  <ol>
    <li><a href="?page=1">1</a></li>
    <li><a href="?page=2">2</a></li>
    <li><a href="?page=3">3</a></li>
    <li><a href="?page=4">4</a></li>
    <li><a href="?page=5">5</a></li>
  </ol>
</rh-pagination>

<link rel="stylesheet" href="../rh-pagination-lightdom.css">

<script type="module">
  import '@rhds/elements/rh-pagination/rh-pagination.js';
</script>
Copy to Clipboard Wrap lines

Implementation guidelines

Basic Structure

  • <rh-pagination> must have a nested <ol> element with at least one nested <li> and <a> element.
  • Each <a> element must have an href attribute that links to the corresponding page.

URL Structure Options

You can implement pagination URLs using any of these approaches:

Option 1: Hash fragments (recommended for client-side routing)

  • Example: example.redhat.com/search/#2, example.redhat.com/search/#3
  • If using query parameters, ensure the hash comes after: example.redhat.com/search/?q=test#2

Option 2: Query parameters

  • Example: example.redhat.com/search?page=2, example.redhat.com/search?page=3
  • Can be combined with other query parameters: example.redhat.com/search?q=test&page=2

Option 3: Path-based URLs

  • Example: example.redhat.com/search/page/2, example.redhat.com/search/page/3

Option 4: Manual control with aria-current

  • Set aria-current="page" on the current page's <a> element
  • Useful for server-side rendered pagination

How the Current Page is Determined

The component determines the active page in this order:

  1. Looking for an aria-current="page" attribute on an <a> tag
  2. Matching the full URL (pathname, search parameters, and hash) against each link's href
  3. If no match is found, the component logs a warning: "could not determine current link"

rh-pagination

Enables navigation across pages of content using first/prev/next/last stepper buttons, numbered page links, and a direct page-input field. Authors MUST provide a single <ol> child with <li><a> page links. The active page is determined by aria-current="page" or URL match. Supports box and open variants, default and small sizes, and compact layout. Tab moves focus through steppers and input; Enter activates. Screen readers announce the <nav> landmark with the label property. Truncation with ellipsis appears automatically beyond 9 pages.

Slots 3

Slot Name Summary Description
go-to-page

page input label text (go-to-page slot)

Label text preceding the page number input field. Defaults to "Page". Customize for internationalization. Visually hidden at very small widths but always accessible to screen readers via aria-labelledby.

out-of
[default]

page link list (default slot)

An <ol> containing <li><a> elements for each page. The active page link MUST have aria-current="page" or match the current URL. Screen readers announce this as a navigation landmark labeled by the label property.
Note: [default] unnamed slots do not have a slot="name" attribute.

Attributes 8

Attribute DOM Property Description Type Default
overflow overflow

Controls which end(s) of the page list are truncated with ellipsis. Accepts 'start' | 'end' | 'both' | null. Computed automatically from page count and current index. Reflected to the host attribute so light-DOM CSS can hide overflow <li> elements. Defaults to null.

'start' | 'end' | 'both' | null
null
label label

Accessible label for the <nav> landmark. SHOULD be unique when multiple paginations exist on a page. Defaults to 'Page navigation'.

string
'Page navigation'
label-first labelFirst

Accessible label for the first-page stepper button. Used by screen readers. Defaults to 'first page'.

string
'first page'
label-previous labelPrevious

Accessible label for the previous-page stepper button. Used by screen readers. Defaults to 'previous page'.

string
'previous page'
label-next labelNext

Accessible label for the next-page stepper button. Used by screen readers. Defaults to 'next page'.

string
'next page'
label-last labelLast

Accessible label for the last-page stepper button. Used by screen readers. Defaults to 'last page'.

string
'last page'
size size

Controls pagination size. Accepts 'sm' for smaller touch targets (WCAG AA) or null for default (WCAG AAA). Defaults to null.

'sm' | null
null
variant variant

Visual variant. Accepts 'open' for transparent backgrounds with bottom borders, or null for the default box variant. Defaults to null.

'open' | null
null

Methods 5

Method Name Description
first()

Navigate to the first page

prev()

Navigate to the previous page

next()

Navigate to the next page

last()

Navigate to the last page

go(page: 'first' | 'prev' | 'next' | 'last' | number)

Navigate to a specific page

Events 0

None

CSS Shadow Parts 4

Part Name Summary Description
numeric

shared container for the numeric controls at all widths

container

pagination container

numeric-middle

container for the numeric control at medium screen widths

numeric-end

container for the numeric control at small and large screen widths

CSS Custom Properties 4

CSS Property Description Default
--rh-color-icon-status-disabled
--rh-pagination-stepper-color

Sets the stepper color.

var(--rh-color-gray-50, #707070)
--rh-pagination-background-focused

Sets the disabled stepper color.

--rh-pagination-accent-color

--rh-pagination-accent-color Controls the accent color used for interactive elements and focus states. Defaults to --rh-color-interactive-primary-default (interactive blue).

Usage guidelines:

  • Sets outline color when page input field has focus
  • Applied to bottom border of active/hovered page links
  • Used for focus indicators on navigation controls
  • Keep default for consistent interactive color across pages
  • Customize only when brand guidelines require specific accent colors
  • Ensure sufficient contrast with background (4.5:1 ratio minimum)
var(--rh-color-interactive-primary-default)

Design Tokens 34

Token Description Copy
--rh-length-3xl

48px length token

Full CSS Variable Permalink to this token
--rh-space-xs

4px spacer

Full CSS Variable Permalink to this token
--rh-color-interactive-primary-hover
Full CSS Variable Permalink to this token
--rh-color-interactive-primary-visited-default
Full CSS Variable Permalink to this token
--rh-color-interactive-primary-visited-hover
Full CSS Variable Permalink to this token
--rh-color-surface-lighter

Tertiary surface (light theme)

Full CSS Variable Permalink to this token
--rh-color-surface-dark

Tertiary surface (dark theme)

Full CSS Variable Permalink to this token
--rh-color-text-primary-on-dark

Primary text color for dark theme

Full CSS Variable Permalink to this token
--rh-color-border-subtle-on-light

Subtle border color (light theme)

Full CSS Variable Permalink to this token
--rh-color-text-secondary-on-dark

Secondary text color for dark theme

Full CSS Variable Permalink to this token
--rh-font-family-heading

Pagination typeface

Heading font family

Full CSS Variable Permalink to this token
--rh-font-size-heading-xs

Pagination text size

h6 heading font size

Full CSS Variable Permalink to this token
--rh-border-width-lg

3px border width: Example: Expanded Accordion panel

Full CSS Variable Permalink to this token
--rh-color-border-interactive
Full CSS Variable Permalink to this token
--rh-space-2xl

Pagination end margin

32px spacer

Full CSS Variable Permalink to this token
--rh-length-2xl

Pagination block size

32px length token

Full CSS Variable Permalink to this token
--rh-length-4xl

Pagination inline size

64px length token

Full CSS Variable Permalink to this token
--rh-color-surface-lightest

Primary surface (light theme)

Full CSS Variable Permalink to this token
--rh-color-surface-darkest

Primary surface (dark theme)

Full CSS Variable Permalink to this token
--rh-color-border-subtle
Full CSS Variable Permalink to this token
--rh-color-gray-60

Secondary text (light theme)

Full CSS Variable Permalink to this token
--rh-color-text-primary

Pagination text color

Full CSS Variable Permalink to this token
--rh-color-interactive-primary-default
Full CSS Variable Permalink to this token
--rh-space-sm

Pagination vertical spacing

6px spacer

Full CSS Variable Permalink to this token
--rh-space-md

Pagination horizontal spacing

8px spacer

Full CSS Variable Permalink to this token
--rh-color-red-60

Dark brand red

Full CSS Variable Permalink to this token
--rh-color-red-40

Light brand red

Full CSS Variable Permalink to this token
--rh-font-size-body-text-md

Pagination text size

Pagination text size

16px font size

Full CSS Variable Permalink to this token
--rh-border-width-sm

1px border width; Example: Secondary CTA or Button

Full CSS Variable Permalink to this token
--rh-color-gray-50

Subtle icon

Full CSS Variable Permalink to this token
--rh-color-gray-40

Subtle icon (hover state)

Full CSS Variable Permalink to this token
--rh-border-radius-default

Pagination corner rounding

Pagination corner rounding

3px border radius; Example: Card

Full CSS Variable Permalink to this token
--rh-border-width-md

Pagination focus outline

Pagination focus outline

2px border width: Example: Alert

Full CSS Variable Permalink to this token
--rh-space-lg

Pagination horizontal margin

Pagination start margin

16px spacer

Full CSS Variable Permalink to this token
© 2026 Red Hat Deploys by Netlify