`CurrentPageLabel`
component to display the current page index. However, these are cases where the pages are numbered by custom labels, for example:`CurrentPageLabel`
component has a render prop which is a function accepting a `RenderCurrentPageLabelProps`
parameter and returns a React element.`RenderCurrentPageLabelProps`
type introduces a new `pageLabel`
parameter which indicates the page label.Property | Type | Description | From |
---|---|---|---|
`currentPage` | `number` | The current page number | 2.0.0 |
`numberOfPages` | `number` | The total number of pages | 2.0.0 |
`pageLabel` | `string` | The page label | 2.10.0 |
import type { RenderCurrentPageLabelProps } from '@react-pdf-viewer/page-navigation';<CurrentPageLabel>{(props: RenderCurrentPageLabelProps) => (<>{`${props.currentPage + 1} ${props.pageLabel === `${props.currentPage + 1}` ? '' : ` (${props.pageLabel})`} of ${props.numberOfPages}`}</>)}</CurrentPageLabel>;