Browse documentation

Pagination

Navigate large result sets one page at a time.

Import

Load the optional component layer before using the examples below.

Ruby
require "zaniah/ui"

Example

Pass a one-based current page and total page count. on_change receives the requested page.

Rendered example
Pagination control showing a window around page four.
Rendered by Zaniah's headless backend.
Ruby
Zaniah::UI::Pagination.new(page: 4, pages: 12)
  .on_change { |page| puts page }

API summary

Constructor options and behaviors are drawn from the component reference.

ComponentConstructor and methodsVariants or behavior
Pagination(page:, pages:, window:); on_changeprevious/window/next

Accessibility

Pagination is a navigation region with previous, numbered, and next controls.

ComponentSemantic role
Paginationnavigation