Pagination

Numbers, as far as the eye can see
Includes a Ruby component and corresponding Rails helper
Ruby

Example

<%= nk_pagination do |p| %>
  <%= p.prev %>
  <%= p.page(1) %>
  <%= p.ellipsis %>
  <%= p.page(42) %>
  <%= p.next %>
<% end %>

Pagy Docs

Nitro Kit comes with built-in support for the gem Pagy. That's a freebie!

nk_pagy_nav has the same API as pagy_nav.

<%= nk_pagy_nav(pagy) %>

Usage

nk_pagination(**attrs) { ... }
PropertyDefaultDescription
**attrsHTML attributes for <nav> element
pagination.prev(text = nil, **attrs) { ... }
PropertyDefaultDescription
textPreviousPlain text content
**attrsHTML attributes for <a> element
pagination.next(text = nil, **attrs) { ... }
PropertyDefaultDescription
textNextPlain text content
**attrsHTML attributes for <a> element
pagination.page(text = nil, **attrs) { ... }
PropertyDefaultDescription
textnilPlain text content
currentfalse Whether the page is the current page.
**attrsHTML attributes for <a> element
pagination.ellipsis(**attrs)
PropertyDefaultDescription
**attrsHTML attributes for <button> element
nk_pagy_nav(pagy, id: nil, aria_label: nil, **attrs)
PropertyDefaultDescription
pagy A Pagy instance.
**attrsHTML attributes for <nav> element