View Source Scrivener.Components.BootstrapV5 (scrivener_components v0.1.0)

Bootstrap 5 pagination component for the Scrivener library

Based on https://getbootstrap.com/docs/5.3/components/pagination/#overview

Renders the following structure:

<nav aria-label="Page navigation example">
  <ul class="pagination">
    <li class="page-item"><a class="page-link" href="#">Previous</a></li>
    <li class="page-item"><a class="page-link" href="#">1</a></li>
    <li class="page-item"><a class="page-link" href="#">2</a></li>
    <li class="page-item"><a class="page-link" href="#">3</a></li>
    <li class="page-item"><span class="page-link"></span></li>
    <li class="page-item"><a class="page-link" href="#">Next</a></li>
  </ul>
</nav>

Summary

Functions

Renders a pagination component

Functions

Renders a pagination component

Examples

<.pagination page={@page} url_params={["q", "term"]} path={&~p"/index?#{&1}"} />

Attributes

  • page (Scrivener.Page) (required) - a %Scrivener.Page{} struct returned from Repo.paginate/2.
  • url_params (:list) - a list of tuples for the query parameters that will persist accross pagination (typically the current search, filter and/or sort parameters). Defaults to [].
  • page_param (:string) - Defaults to "page".
  • path (:any) (required) - a 1-arity function that receives the url_params merged with the current page number (page) and return the path. Typically a verified route sigil.
  • navigation_mode (:atom) - the link component navigation mode. Defaults to :navigate.
  • options (:any) - a Keyword list that can be used to customize the behaviour of the pagination. See Scrivener.Components.PaginationLinks defaults. Defaults to [].
  • Global attributes are accepted.