Pagination and View More
Pagination & View More are controls that allow users to view additional records within a data set.
View More
When to Use
- View More is the preferred method for displaying records from a large data set in a progressive manner.
When Not to Use
- Technology limitations or the need to allow users to navigate to specific subsets of data may drive the need Pagination to be used.
Variations
- View More (shown above)
- View More with Lazy Load
- Pagination
Usage
- View more is the preferred control for allowing users to view additional results within a large data set and should be used in most contexts.
- For optimal ease of use, the View More button may be combined with lazy loading (automatically displaying additional results as the user scrolls down the screen). For example, start by displaying 10-30 results and when the user scrolls to the end of this set, begin displaying additional results (in a similar increment of 10-30). After two-three automatic displays, the View More button should appear to confirm the user’s intention. This allows for performance optimization while maintaining the user’s ability to access content that may appear below the result set.
- It is also recommended that the number indicate the number of additional results, for example: “Load 10 more results.” An option to “View All Results” may also be used for smaller data sets.
- When using View More, a Scroll to Top button should be used to allow users to easily return to the top of the screen.
Variations
View More with Lazy Load
When to Use
- This combination is best for contexts in which users are in an exploratory mode and when it is not critical for them the navigate to a specific subset of results.
Pagination
When to Use
- When there are technology limitations or legacy formats that require a page refresh to load additional results/content.
- When users may need to navigate/link to a specific page of results in the set.
Additional Information
Pagination may include up to three sections:
- Page numbers and navigation arrows (required)
- Current range and total number of results (recommended)
- Number of results per page (optional)
To conserve space on mobile, the pagination numbers can range from 2 to 5 page numbers.
If there is a only one page of results (but additional results could display based on search criteria), there should still be a pagination mechanism.
Developer Notes
View More
Adding the spark-btn--view-more
class to the button will override the default button styling.
When making your network call to load more content in, you will need to add a Progress Indicator to the button. The example shows how a mock connection might work. The button is changed during the network request, and then reverted to it’s original state once the request is complete.
View More with Lazy Load
Adding the spark-progress--lazy-load
class will alter the progress indicator to the lazy load style.
Adding the spark-progress--disabled
will hide the progress meter and change the text to a disabled style, when there are no more results to load.
Pagination
The pagination component consists of three parts: the page list, the results per-page select input, and the total results count.
At the start and end of the page list should be a next and previous arrow, respectively. Any text contained inside the .spark-pagination__arrow-text
element will be hidden at the extra small breakpoint.
Each item in the page list should be given a class of spark-pagination__item
. The active item should receive an additional class of spark-pagination__item--active
.
The results per-page select input uses the special “no label” version of the select input by adding the spark-select--no-label
class.
Truncated Example
When there are too many items to show in the page list, additional elements with the class spark-pagination__ellipsis
should be used as a wrapper form a set of three dots. Always make sure you show the first and last item of the list.
Accessibility Notes
Pagination links may require additional context to provide users of assistive devices the proper information to successfully navigate your product or site. With that in mind, the examples provided include aria-labels
on the <nav>
and <a>
elements to provide more context. An aria-current
attribute has also been added to the current page link to indicate that it is the current page the user is on. Ensure that these attributes are added to your implementation and changed to the appropriate values