Skip to main content

Pagination

The Pagination component is used to navigate through large datasets by splitting content into discrete pages. It supports two layout types: default (full layout with a display options dropdown) and compact (minimal controls).

Import

// with @dhl-official/react-library:
import { DhlPagination } from "@dhl-official/react-library"
// with @dhl-official/ui-libraries/react-library:
import { DhlPagination } from "@dhl-official/ui-libraries/react-library"

Code

<DhlPagination
totalItems={200}
itemsPerPage={10}
currentPage={1}
counterLabel="shipments"
/>

Examples

Default

Full layout with display options dropdown, counter text, and page navigation.


Code example
<DhlPagination
totalItems={200}
itemsPerPage={10}
currentPage={1}
counterLabel="shipments"
/>

Compact

Minimal pagination control with counter and page navigation.



Code example
<DhlPagination
type="compact"
totalItems={200}
itemsPerPage={10}
currentPage={1}
counterLabel="shipments"
/>

Without counter


Code example
<DhlPagination
totalItems={200}
itemsPerPage={10}
currentPage={1}
counter={false}
counterLabel="shipments"
/>

Without display options


Code example
<DhlPagination
totalItems={200}
itemsPerPage={10}
currentPage={1}
displayOptions={false}
counterLabel="shipments"
/>

Interactive Demo

Readme

Properties

PropertyAttributeDescriptionTypeDefault
countercounterAn optional prop to show/hide the counter text ("Showing X-Y of Z").booleantrue
counterLabelcounter-labelAn optional prop for the counter label suffix (e.g. "shipments").string"shipments"
currentPagecurrent-pageAn optional prop for the current active page (1-based).number1
dataClassNamedata-class-nameAn optional class name prop for the component.stringundefined
dataIddata-idAn optional prop. Gives a valid HTML ID attribute value for the component.string`dhl-pagination-${getRandomString()}`
dataTestiddata-testidAn optional prop. The test id attached to the component as a data-testid attribute.stringundefined
displayLabeldisplay-labelAn optional prop for the label text shown next to the display dropdown.string"Display"
displayOptionsdisplay-optionsAn optional prop to show/hide the items-per-page dropdown menu.booleantrue
itemsPerPageitems-per-pageAn optional prop for items displayed per page.number10
itemsPerPageOptionsitems-per-page-optionsAn optional prop for the available items-per-page options.number[][10, 12, 24, 48]
totalItemstotal-itemsA REQUIRED prop for the total number of items.numberundefined
typetypeAn optional prop to select the pagination type. "default" shows the full layout with display options dropdown. "compact" shows a minimal pagination control."compact" | "default"DHL_PAGINATION.TYPE.DEFAULT

Events

EventDescriptionType
dhlItemsPerPageChangeEmitted when items per page changes.CustomEvent<{ itemsPerPage: number; }>
dhlPageChangeEmitted when the page changes.CustomEvent<{ page: number; }>

Dependencies

Depends on

Graph


Built by DHL User Interface Library Team!