Pagy adds lightweight pagination to Ruby apps with offset, keyset, search, and calendar strategies plus optional client-side nav widgets and JSON formats.
Overview
Pagy is a Ruby pagination library designed to stay small, fast, and framework-agnostic across Rack-compatible stacks. It autoloads only the helpers you use and supports several pagination techniques in plain Ruby.
Supported modes include offset, countless, keyset, keynav, search integrations, and calendar pagination across year, quarter, month, week, and day units. Server-rendered helpers cover Pagy, Bootstrap, and Bulma styles, while JavaScript variants adapt to container width or compact input navigation.
Search paginators integrate with Elasticsearch Rails, Meilisearch, Searchkick, Typesense Rails, and related adapters. JSON:API and client JSON hashes are available for API responses.
Documentation includes quick start recipes, migration notes from older gems, interactive dev tools, and end-to-end test coverage for Ruby, HTML, and JavaScript components.
Key features
- Offset, keyset, and calendar paginators
- Search backend integrations
- Bootstrap and Bulma nav helpers
- Client-side responsive nav scripts
- JSON:API compatible responses
- Autoloaded minimal core
- Interactive theme integration wand
- High test coverage
Use cases
- Paginating Rails or Sinatra collections
- Keyset pagination for large tables
- Search-backed result paging
- Calendar-based archive navigation