Skip to content

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

Nothing is downloaded until you press it.

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

OptionTypeDefaultWhat it does
aroundstd::size_t1How 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.
arrowsbooltrueDraw the previous and next arrows. Off leaves only the numbers, for a strip that sits under something with its own paging controls.
namestd::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.
sizefloat12.5f

Released under the LGPL-3.0-or-later licence.