Skip to main content
Neighborhood Design System v5.1.0

Pagination

Ready

The Pagination component enables users to navigate through large sets of data by dividing content into discrete pages.

Preview

Open in Storybook (opens in new tab)

Code

Install
npm install @fbin-web/neighborhood-core
Import
import { NbhdPagination } from '@fbin-web/neighborhood-core';
Usage
<nbhd-pagination
  current-page="2"
  total-pages="10"
  max-visible-pages="3"
  surface="secondary">
</nbhd-pagination>

Properties

PropertyAttributeTypeDefaultDescription
surfacesurfacenoneprimarysecondaryinverseinverse-secondaryprimarySurface to apply to the component
marginTopmargin-topnonesmallmediumlargenoneTop margin spacing.
marginBottommargin-bottomnonesmallmediumlargenoneBottom margin spacing.
paddingToppadding-topdefaultnonesmallmediumlargedefaultTop padding spacing.
paddingBottompadding-bottomdefaultnonesmallmediumlargedefaultBottom padding spacing
maxVisiblePagesmax-visible-pagesnumber3The maximum number of page buttons to display at once
showLabelsshow-labelsbooleanfalseWhether to show labels on the pagination arrows
currentPagecurrent-pagenumber1The current active page
totalPagestotal-pagesnumber1The total number of pages
nextLabelnext-labelstringNextThe label for the next page arrow button
previousLabelprevious-labelstringPreviousThe label for the previous page arrow button
nextAriaLabelnext-aria-labelstring—Accessible name for the Next button. Defaults to "Next page", or to `next-label` when that has been changed so the name matches the visible text.
previousAriaLabelprevious-aria-labelstring—Accessible name for the Previous button. Defaults to "Previous page", or to `previous-label` when that has been changed.
labellabelstringPaginationAccessible name of the pagination navigation landmark.
pageLabelpage-labelstringPage {page}Accessible name of each page button; `{page}` is replaced with the page number.
onNbhdPageChangedon-nbhd-page-changed(event: CustomEvent<{ page: number }>) => void—Callback function when page changes

Events

NameDescriptionEvent Detail
nbhd-page-changedEmitted when the user navigates to a different page.{ page: number }

CSS Parts

Exposed CSS parts for styling specific elements within the pagination component.

NameDescription
page-buttonIndividual page number buttons for navigation.
ellipsisThe ellipsis text elements ("...") shown between page ranges.
baseThe main component wrapper element.
navThe
controlsThe
    list of Previous, page and Next controls.
previous-buttonThe Previous button. Stays rendered on the first page with aria-disabled="true".
pagination-item-svgThe SVG arrow icons within the previous and next buttons.
previous-labelThe text label for the previous button (when showLabels is true).
next-buttonThe Next button. Stays rendered on the last page with aria-disabled="true".
next-labelThe text label for the next button (when showLabels is true).
nbhd-pagination::part(page-button) {
  /* your styles */
}

CSS Properties

Set these on nbhd-pagination or an ancestor to override the defaults. Token is the design token a default comes from and Value is what it resolves to in core Neighborhood; brands may override them. Properties that adapt to surface follow the light or inverse surface they sit on until you set them.

Pagination

PropertyTokenValue Copy
--nbhd-pagination-controls-alignItems—center
--nbhd-pagination-controls-display—flex
--nbhd-pagination-controls-gap--nbhd-space-28px
--nbhd-pagination-controls-justifyContent—center
--nbhd-pagination-controls-whiteSpace—nowrap
--nbhd-pagination-display—flex
--nbhd-pagination-ellipsis-fontSize--nbhd-typography-subheading-fontSize1.125rem
--nbhd-pagination-ellipsis-marginBlock--nbhd-space-00px
--nbhd-pagination-inlineSize—100%
--nbhd-pagination-item-active-background-opacity—1
--nbhd-pagination-item-background-opacity—0
--nbhd-pagination-item-borderRadius--nbhd-border-radius-md6px
--nbhd-pagination-item-fontSize--nbhd-typography-subheading-fontSize1.125rem
--nbhd-pagination-item-hover-background-opacity—0.25
--nbhd-pagination-item-icon-display—inline-block
--nbhd-pagination-item-label-display—inline-block
--nbhd-pagination-item-label-fontSize--nbhd-typography-body-fontSize1rem
--nbhd-pagination-item-label-paddingInline--nbhd-space-052px
--nbhd-pagination-item-minBlockSize--nbhd-size-control-sm28px
--nbhd-pagination-item-next-svg-transform—rotate(-90deg)
--nbhd-pagination-item-paddingBlock--nbhd-space-14px
--nbhd-pagination-item-paddingInline--nbhd-space-14px
--nbhd-pagination-item-previous-svg-transform—rotate(90deg)
--nbhd-pagination-item-svg-maxBlockSize—6px
--nbhd-pagination-item-svg-maxInlineSize--nbhd-size-icon-xs10px
--nbhd-pagination-item-svg-transform—none
--nbhd-pagination-justifyContent—center
--nbhd-pagination-marginInline—0
--nbhd-pagination-paddingBlock--nbhd-space-14px
--nbhd-pagination-paddingInline—0

Action plain

PropertyTokenValue Copy
--nbhd-action-plain-backgroundColor--nbhd-color-action-plain-backgroundrgba(0, 0, 0, 0)
--nbhd-action-plain-borderColor—Override only
--nbhd-action-plain-color--nbhd-color-action-plain-foreground#1b5e20

Pagination item

PropertyTokenValue Copy
--nbhd-paginationItem-active-color--nbhd-context-color-action-primary-foregroundAdapts to surface

Dependencies

Child components <nbhd-pagination> renders internally. Import them too when you tree-shake.

Used by

Esc
↑ ↓ to move↵ to open