Components
Pagination
Pagination
Pagination is the method of splitting up content into discrete pages. It specifies the total number of pages and inidicates to a user the current page within the context of total pages.
Basic pagination
<.pagination link_type="a" class="mb-5" path="/:page" current_page={1} total_pages={10} />
<.pagination link_type="live_patch" class="mb-5" path="/:page" current_page={5} total_pages={10} />
<.pagination link_type="live_redirect" class="mb-5" path="/:page" current_page={10} total_pages={10} />
<.pagination path={fn page -> Routes.user_path(Endpoint, :index, [page: page]) end} current_page={1} total_pages={10} />
Interactive pagination
<.pagination
link_type="live_patch"
path="/components/pagination/:page"
current_page={@pagination_page} total_pages={10}
/>
Properties
# <.pagination>
attr(:path, :string, default: "/:page", doc: "page path")
attr(:class, :string, default: "", doc: "Parent div CSS class")
attr(:link_type, :string, default: "a", values: ["a", "live_patch", "live_redirect"])
attr(:total_pages, :integer, default: nil, doc: "sets a total page count")
attr(:current_page, :integer, default: nil, doc: "sets the current page")
attr(:sibling_count, :integer, default: 1, doc: "sets a sibling count")
attr(:boundary_count, :integer, default: 1, doc: "sets a boundary count")
attr(:show_boundary_chevrons, :boolean, default: false, doc: "shows boundary chevrons")
attr(:rest, :global)