GraphQL queries can return up to 2000 records. By default, the wire adapter returns the first 10 results and you can request subsequent pages using the cursor information. The GraphQL API and graphql wire adapter use the GraphQL Cursor Connections Specification for pagination of all data collections they return.
Query with Cursor Information
To specify the number of records to return, use the first argument. The default number is 10. If hasNextPage is true, you can provide the endCursor value to the after argument of a subsequent query, which requests the next page of results.
Backward pagination using last and before isn’t currently supported.
Requesting totalCount can have performance implications for large or complex queries.
Tip
Implement Pagination in LWC
In this example, we create a simplePagination component with a reset button and a next page button. The reset button resets the pagination. The next page button pages through the results. The component displays 5 results on each page by default. It uses an isLastPage property to determine if the next page button is disabled.
The component uses the lightning-button base component to display the reset button and next page button. It displays the account name and annual revenue in the lightning-card base component.