PUI. Pagination
(pui v1.0.0)
Copy Markdown
Accessible, host-controlled pagination links.
Pagination renders navigation markup and page links. It does not load data,
change LiveView assigns, or decide how URLs are built. Pass a one-argument
page_url function and choose whether links use href, navigate, or
patch.
Example
<.pagination
current_page={@page}
total_pages={@total_pages}
page_url={fn page -> ~p"/projects?page=#{page}" end}
link_mode="patch"
/>Attributes
| Name | Type | Default | Description |
|---|---|---|---|
current_page | integer | required | Current one-based page |
total_pages | integer | required | Total one-based page count |
page_url | function | required | Function receiving a page number |
link_mode | string | "patch" | "href", "navigate", or "patch" |
window | integer | 2 | Pages shown around the current page |
aria_label | string | "Pagination" | Navigation landmark label |
class | string | "" | Additional CSS classes |
rest | global | — | Global HTML attributes |
Slots
previous, next, and page are optional slots. The page slot receives
the page number through :let and can replace the default numeric label.
Summary
Functions
Attributes
current_page(:integer) (required)total_pages(:integer) (required)page_url(:any) (required)link_mode(:string) - Defaults to"patch". Must be one of"href","navigate", or"patch".window(:integer) - Defaults to2.aria_label(:string) - Defaults to"Pagination".class(:string) - Defaults to"".- Global attributes are accepted.
Slots
previousnextpage