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
Defaults are indicated in bold . In the `path` param you can specify :page as the place your page number will appear. e.g "/posts/:page" => "/posts/1"
Name | Type | Options |
---|---|---|
path | :string | - |
sibling_count | :integer | - |
boundary_count | :integer | - |
link_type | :string |
a
, `live_patch`, `live_redirect`, `button`
|
class | :string | - |