Pagination
pagination · Elements · interactive
Which page you are on, and the ones you can reach from here.
Import
cpp
#include "gbui/widgets/pagination.hpp"Example
cpp
PaginationResult pagination(Ui& ui, const Interaction& input, std::string_view id, std::size_t current, std::size_t pageCount, const PaginationOptions& options = {});A paginator for pageCount pages, sitting on current (zero-based). Left and Right step a page while the control has focus, Home and End reach the ends. The current page carries current — ARIA's aria-current, not selected: the reader is being told where they are, not that they chose it from a set of options they could choose differently.
API
PaginationOptions
| Option | Type | Default | What it does |
|---|---|---|---|
around | std::size_t | 1 | How many numbered buttons to draw around the current page, on each side. One gives 1 … 4 5 6 … 20, which is the shape most sites settled on: far enough to step without aiming, small enough to fit on a narrow window. |
arrows | bool | true | Draw the previous and next arrows. Off leaves only the numbers, for a strip that sits under something with its own paging controls. |
name | std::string_view | "Pagination" | What the whole control is for — "Search results". A paginator with no name is a row of numbers a reader has to infer the subject of. |
size | float | 12.5f |