© 2017-2022 Domizio DemichelisMIT License

➡ Chat Support on Gitter ➡

Extras

Pagy comes with a growing number of optional extras, that add core, backend, frontend or special features to the regular core features.

Extra Description Links
arel Better performance of grouped ActiveRecord collections arel.rb, documentation
array Paginate arrays efficiently avoiding expensive array-wrapping and without overriding array.rb, documentation
bootstrap Add nav, nav_js and combo_nav_js helpers for the Bootstrap pagination component bootstrap.rb, documentation
bulma Add nav, nav_js and combo_nav_js helpers for the Bulma pagination component bulma.rb, documentation
calendar Add pagination filtering by calendar time unit (year, quarter, month, week, day) calendar.rb, documentation
countless Paginate without any count, saving one query per rendering countless.rb, documentation
elasticsearch_rails Paginate elasticsearch_rails gem results efficiently elasticsearch_rails.rb, documentation
foundation Add nav, nav_js and combo_nav_js helpers for the Foundation pagination component foundation.rb, documentation
gearbox Automatically change the number of items per page depending on the page number gearbox.rb, documentation
headers Add RFC-8288 compliant http response headers (and other helpers) useful for API pagination headers.rb, documentation
i18n Use the I18n gem instead of the pagy implementation i18n.rb, documentation
items Allow the client to request a custom number of items per page with a ready to use selector UI items.rb, documentation
materialize Add nav, nav_js and combo_nav_js helpers for the Materialize CSS pagination component materialize.rb, documentation
meilisearch Paginate Meilisearch results efficiently meilisearch.rb, documentation
metadata Provides the pagination metadata to Javascript frameworks like Vue.js, react.js, etc. metadata.rb, documentation
navs Add nav_js and combo_nav_js javascript unstyled helpers navs.rb, documentation
overflow Allow for easy handling of overflowing pages overflow.rb, documentation
searchkick Paginate Searchkick::Results objects efficiently searchkick.rb, documentation
semantic Add nav, nav_js and combo_nav_js helpers for the Semantic UI CSS pagination component semantic.rb, documentation
standalone Use pagy without any request object, nor Rack environment/gem, nor any defined params method, even in the irb/rails console without any app or config. standalone.rb, documentation
support Extra support for features like: incremental, infinite, auto-scroll pagination support.rb, documentation
trim Remove the page=1 param from links trim.rb, documentation
tailwind Extra styles for Tailwind CSS documentation
uikit Add nav, nav_js and combo_nav_js helpers for the UIkit pagination component uikit.rb, documentation

Synopsis

Extras are not loaded by default, so you should require them explicitly in your pagy.rb initializer (see How to configure pagy):

require 'pagy/extras/bootstrap'
require 'pagy/extras/...'

Description

Extras add features by defining their own *Extra module that get prepended to other pagy classes or modules. This neatly separates the core code from the optional extras, leaving a trace in the ancestors array to improve introspection and debugging info.

Notice: In previous Pagy versions extras were re-opening the Pagy class and modules. That is good as long as you have just a few extras… which is not the case anymore.

Methods

A few extras require the pagy/extras/frontend_helpers file. It defines only a few methods used internally, so you don’t actually need to use them directly.

Notice: All the other added methods are documented in the respective extras doc.

Javascript Helpers

A few frontend extras add helpers that use javascript, and they are clearly recognizable by the js suffix:

See Javascript