Pagination: the canvas pager (lu-pg2, shape canvas, rounded or pill) or the classic
bar of buttons (lu-pages, shape="classic"), in three sizes.
<.pagination page={@page} total_pages={10} patch={&"/orders?page=#{&1}"} />
<.pagination page={@page} total_pages={10} on_change="paginate" shape="pill" />Each page is a link when patch, navigate or href is given (a function from the page number
to a path); otherwise a button pushing on_change with %{"page" => "3"} (to target). With
neither, the pager is display-only (plain spans). Pages far from the current one collapse
into …: siblings pages on each side of the current one and boundaries at each end.
A list footer: total_entries and page_size add the "Showing 1–15 of 128" summary (and work
out total_pages), page_sizes a rows-per-page select in its own <form> pushing
on_page_size with %{"page_size" => "30"}. With a summary, a select or an :aside the root
is a lu-row around the pages.
The canvas shapes style > span, so interactive pages are spans holding the
button or link. summary defaults to "Showing %{first}–%{last} of %{total}" when
total_entries is given; an explicit summary is shown as-is without it.
Accessibility, rendered server-side: the current page carries aria-current="page" (on the
link/button, or on the span when the pager is display-only), every page and arrow has an
aria-label (page_label, prev_label, next_label), the summary is role="status".
shape="classic" is an addition to the README.
Summary
Functions
Attributes
page(:integer) (required)total_pages(:integer) - Defaults tonil.total_entries(:integer) - Defaults tonil.page_size(:integer) - Defaults tonil.page_sizes(:list) - Defaults to[].on_page_size(:any) - Defaults tonil.summary(:string) - Defaults tonil.page_size_label(:string) - Defaults to"%{size} / page".page_size_aria(:string) - Defaults to"Rows per page".siblings(:integer) - Defaults to1.boundaries(:integer) - Defaults to1.patch(:any) - Defaults tonil.navigate(:any) - Defaults tonil.href(:any) - Defaults tonil.on_change(:any) - Defaults tonil.target(:any) - Defaults tonil.divided(:boolean) - Defaults tofalse.shape(:string) - Defaults to"canvas". Must be one of"canvas","rounded","pill", or"classic".variant(:string) - The same asshape; it wins when given. Defaults tonil. Must be one ofnil,"canvas","rounded","pill", or"classic".size(:string) - Defaults to"md". Must be one of"sm","md", or"lg".arrows(:boolean) - Defaults totrue.prev_label(:string) - Defaults to"Previous page".next_label(:string) - Defaults to"Next page".page_label(:string) - Defaults to"Page %{page}".page_attrs(:any) - Function from a page number (or:ellipsis) to extra attrs (%{style: ..., class: ...}) of its item, e.g. for staggered animations. Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
aside