Pagination

Description

Organize your content into discrete pages, allowing users to navigate through large datasets or collections with ease.

FREE
This component is available for free. It implements the Bootstrap Pagination component. See the installation instructions below for more details.

Arguments

Name Default Type Description
pagy Pagy A pagy object.
html_attributes {} Hash Any attributes for the used html wrapper tag

Examples

Default

<%= render Railsboot::PaginationComponent.new(pagy: Pagy.new({count: 50, page: 1})) %>
<nav class="pagy-bootstrap nav" aria-label="Pages">
  <ul class="pagination">
    <li class="page-item prev disabled"><a role="link" class="page-link" aria-disabled="true" aria-label="Previous"><</a></li>
    <li class="page-item active"><a role="link" class="page-link" aria-current="page" aria-disabled="true">1</a></li>
    <li class="page-item"><a href="/components/pagination?page=2" class="page-link">2</a></li>
    <li class="page-item"><a href="/components/pagination?page=3" class="page-link">3</a></li>
    <li class="page-item next"><a href="/components/pagination?page=2" class="page-link" aria-label="Next">></a></li>
  </ul>
</nav>

Installation

Simply download this component with all its related files and assets. Unpackage the downloaded ZIP-file, copy all relevant files into your app and adapt the things you need. The ZIP-folder contains:

  • A parent component class (app/components/railsboot/component.rb) of which all components inherit from.
  • A base component class (app/components/railsboot/base_component.rb) which is used for rendering internally.
  • The desired component itself (app/components/railsboot/pagination_component.rb).
  • A view template (app/components/railsboot/pagination_component.html.erb) for the component unless it's rendered inline.
  • Any other dependent components such as Slots (just if the component needs those)
  • Any dependent assets (JS-Files, CSS-Files) (just if the component needs those)
  • A test file for the components (test/components/railsboot/pagination_component_test.rb) including potential slot or dependency tests.

For more information please refer to the installation section.

Download

Download the component and its related files (e.g. templates, assets, slots etc.), unpackage the zip file and adapt the things you need.