Primitives
The Pagination primitives provide a set of directives to create a pagination control. The pagination control is used to navigate through a set of data that is split into multiple pages.
Import the Pagination primitives from ng-primitives/pagination
.
Assemble the pagination directives in your template.
Create a reusable component that uses the pagination directives.
Generate a reusable pagination component using the Angular CLI.
The following directives are available to import from the ng-primitives/pagination
package:
The NgpPagination
directive is used to create a pagination control.
[ngpPagination]
ngpPagination
The current page number.
The total number of pages.
Emits the new page number when the page changes.
Disables the pagination control.
The following data attributes are applied to the ngpPagination
directive:
Attribute | Description | Value |
---|---|---|
data-page |
The current page number. | number |
data-page-count |
The total number of pages. | number |
data-disabled |
Disables the pagination control. | boolean |
data-first-page |
Whether the current page is the first page. | boolean |
data-last-page |
Whether the current page is the last page. | boolean |
The NgpPaginationButton
directive is used to create a pagination button.
[ngpPaginationButton]
ngpPaginationButton
The page number that the button navigates to.
Disables the pagination button.
The following data attributes are applied to the ngpPaginationButton
directive:
Attribute | Description | Value |
---|---|---|
data-page |
The page number that the button navigates to. | number |
data-selected |
Applied when the button is selected. | - |
data-hover |
Applied when the button is hovered. | - |
data-focus-visible |
Applied when the button is focused. | - |
data-press |
Applied when the button is pressed. | - |
data-disabled |
Disables the pagination button. | - |
The NgpPaginationFirst
directive is used to create a pagination button that navigates to the first page.
[ngpPaginationFirst]
ngpPaginationFirst
Disables the pagination button.
The following data attributes are applied to the ngpPaginationFirst
directive:
Attribute | Description |
---|---|
data-first-page |
Applied when the current page is the first page. |
data-hover |
Applied when the button is hovered. |
data-focus-visible |
Applied when the button is focused. |
data-press |
Applied when the button is pressed. |
data-disabled |
Applied when the button is disabled. |
The NgpPaginationPrevious
directive is used to create a pagination button that navigates to the previous page.
[ngpPaginationPrevious]
ngpPaginationPrevious
Disables the pagination button.
The following data attributes are applied to the ngpPaginationPrevious
directive:
Attribute | Description |
---|---|
data-first-page |
Applied when the current page is the first page. |
data-hover |
Applied when the button is hovered. |
data-focus-visible |
Applied when the button is focused. |
data-press |
Applied when the button is pressed. |
data-disabled |
Applied when the button is disabled. |
The NgpPaginationNext
directive is used to create a pagination button that navigates to the next page.
[ngpPaginationNext]
ngpPaginationNext
Disables the pagination button.
The following data attributes are applied to the ngpPaginationNext
directive:
Attribute | Description |
---|---|
data-last-page |
Applied when the current page is the last page. |
data-hover |
Applied when the button is hovered. |
data-focus-visible |
Applied when the button is focused. |
data-press |
Applied when the button is pressed. |
data-disabled |
Applied when the button is disabled. |
The NgpPaginationLast
directive is used to create a pagination button that navigates to the last page.
[ngpPaginationLast]
ngpPaginationLast
Disables the pagination button.
The following data attributes are applied to the ngpPaginationLast
directive:
Attribute | Description |
---|---|
data-last-page |
Applied when the current page is the last page. |
data-hover |
Applied when the button is hovered. |
data-focus-visible |
Applied when the button is focused. |
data-press |
Applied when the button is pressed. |
data-disabled |
Applied when the button is disabled. |
Copyright © 2025 Angular Primitives