Introducing PrimeReact v11-alpha 🎉Discover Now

Paginator

An unstyled, accessible paginator component with compound composition.

Build fully custom paginators with complete control over layout, page rendering, and navigation styling.

basic-demo

Pre-styled Versions

Choose a pre-styled library to use Paginator with ready-made designs.
For hook-based usage without components, see the Headless API.

Features#

  • Compound component API with nine sub-components: Root, Content, First, Prev, Pages, Page, Ellipsis, Next, Last
  • Smart page range calculation with configurable siblings and edges
  • Automatic ellipsis insertion between page ranges
  • Render function children on Pages for full control over page item rendering

Usage#

import { Paginator } from 'primereact/paginator';
<Paginator.Root>
    <Paginator.Content>
        <Paginator.First></Paginator.First>
        <Paginator.Prev></Paginator.Prev>
        <Paginator.Pages></Paginator.Pages>
        <Paginator.Next></Paginator.Next>
        <Paginator.Last></Paginator.Last>
    </Paginator.Content>
</Paginator.Root>

Behavior#

Polymorphic Rendering#

Use as on any sub-component to change the rendered HTML element.

<Paginator.Root as="div">
    <Paginator.Content as="section">
        <Paginator.First as="a" />
        <Paginator.Prev as="a" />
        <Paginator.Pages />
        <Paginator.Next as="a" />
        <Paginator.Last as="a" />
    </Paginator.Content>
</Paginator.Root>

Default elements: Root=nav, Content=div, First=button, Prev=button, Pages=span, Page=button, Ellipsis=span, Next=button, Last=button.

Render Function Children#

Pages accepts a render function as children, providing access to the component instance. The instance exposes paginator (root instance with pages array and state).

<Paginator.Pages>{(instance) => instance.paginator?.pages.map((page, i) => (page.type === 'page' ? <Paginator.Page key={i} value={page.value} /> : <Paginator.Ellipsis key={i}>...</Paginator.Ellipsis>))}</Paginator.Pages>

Pass Through#

Some parts may not be visible in the preview depending on the component's current state.

Loading...
/* Select a part to see its CSS selector for custom styling */

API#

PaginatorRoot#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: PaginatorRootInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: PaginatorRootInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instancePaginatorRootInstance—
The instance to pass to the component.
ptSafeRecord<PaginatorRootPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: PaginatorRootInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
defaultPagenumber1
Default page number.
pagenumber—
Current page number (controlled).
totalnumber0
Total number of items.
itemsPerPagenumber10
Number of items per page.
onPageChange(event: usePaginatorChangeEvent) => void—
Callback fired when the page changes.
siblingsnumber2
Number of sibling pages to show on each side of current page.
edgesnumber1
Number of edge pages to show at the beginning and end.
disabledbooleanfalse
Whether the paginator is disabled.
showEllipsisbooleantrue
Whether to show ellipsis.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"paginator"
data-part"root"

Defines passthrough(pt) options of Paginator component.

labeltypedescription
rootPaginatorRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.
contentPaginatorRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the content's DOM element.
firstPaginatorRootPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the first's DOM element.
prevPaginatorRootPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the prev's DOM element.
nextPaginatorRootPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the next's DOM element.
lastPaginatorRootPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the last's DOM element.

PaginatorContent#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: PaginatorContentInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: PaginatorContentInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instancePaginatorContentInstance—
The instance to pass to the component.
ptSafeRecord<PaginatorContentPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: PaginatorContentInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of PaginatorContent component.

labeltypedescription
rootPaginatorContentPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the root's DOM element.

PaginatorFirst#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: PaginatorFirstInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: PaginatorFirstInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instancePaginatorFirstInstance—
The instance to pass to the component.
ptSafeRecord<PaginatorFirstPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: PaginatorFirstInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
disabledboolean—
Used to disable the first button.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"paginator"
data-part"first"
data-disabledPresent when disabled

Defines passthrough(pt) options of PaginatorFirst component.

labeltypedescription
rootPaginatorFirstPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the root's DOM element.

PaginatorPrev#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: PaginatorPrevInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: PaginatorPrevInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instancePaginatorPrevInstance—
The instance to pass to the component.
ptSafeRecord<PaginatorPrevPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: PaginatorPrevInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
disabledboolean—
Used to disable the previous button.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"paginator"
data-part"prev"
data-disabledPresent when disabled

Defines passthrough(pt) options of PaginatorPrev component.

labeltypedescription
rootPaginatorPrevPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the root's DOM element.

PaginatorNext#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: PaginatorNextInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: PaginatorNextInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instancePaginatorNextInstance—
The instance to pass to the component.
ptSafeRecord<PaginatorNextPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: PaginatorNextInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
disabledboolean—
Used to disable the next button.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"paginator"
data-part"next"
data-disabledPresent when disabled

Defines passthrough(pt) options of PaginatorNext component.

labeltypedescription
rootPaginatorNextPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the root's DOM element.

PaginatorLast#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: PaginatorLastInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: PaginatorLastInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instancePaginatorLastInstance—
The instance to pass to the component.
ptSafeRecord<PaginatorLastPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: PaginatorLastInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
disabledboolean—
Used to disable the last button.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"paginator"
data-part"last"
data-disabledPresent when disabled

Defines passthrough(pt) options of PaginatorLast component.

labeltypedescription
rootPaginatorLastPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the root's DOM element.

PaginatorPages#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: PaginatorPagesInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: PaginatorPagesInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instancePaginatorPagesInstance—
The instance to pass to the component.
ptSafeRecord<PaginatorPagesPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: PaginatorPagesInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"paginator"
data-part"pages"

Defines passthrough(pt) options of PaginatorPages component.

labeltypedescription
rootPaginatorPagesPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

PaginatorPage#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: PaginatorPageInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: PaginatorPageInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instancePaginatorPageInstance—
The instance to pass to the component.
ptSafeRecord<PaginatorPagePassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: PaginatorPageInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
disabledboolean—
Used to disable the page button.
valuenumber—
Used to set the value of the page button.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"paginator"
data-part"page"
data-activePresent on the current page
data-disabledPresent when disabled

Defines passthrough(pt) options of PaginatorPage component.

labeltypedescription
rootPaginatorPagePassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the root's DOM element.

PaginatorEllipsis#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: PaginatorEllipsisInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: PaginatorEllipsisInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instancePaginatorEllipsisInstance—
The instance to pass to the component.
ptSafeRecord<PaginatorEllipsisPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: PaginatorEllipsisInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of PaginatorEllipsis component.

labeltypedescription
rootPaginatorEllipsisPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the root's DOM element.

Accessibility#

Screen Reader#

Paginator is placed inside a nav element to indicate a navigation section. First, previous, next, and last page navigator buttons include aria-label attributes derived from the aria.firstPageLabel, aria.prevPageLabel, aria.nextPageLabel, and aria.lastPageLabel locale properties respectively.

Page links are button elements with an aria-label derived from the aria.pageLabel locale property. The current page is marked with aria-current="page".

Keyboard Support#

KeyFunction
tabMoves focus through the paginator elements.
enterExecutes the paginator element action.
spaceExecutes the paginator element action.