PureAdmin.Components.Pager (PureAdmin v1.1.0)

Copy Markdown View Source

Pager and LoadMore components for Pure Admin.

Summary

Functions

Renders a load more button.

Renders a pagination control.

Functions

load_more(assigns)

Renders a load more button.

Examples

<.load_more phx-click="load_more" count="25 of 250" />
<.load_more is_loading phx-click="load_more">Loading...</.load_more>
<.load_more align="start" phx-click="load_more">Show More Items</.load_more>

Attributes

  • is_loading (:boolean) - Defaults to false.
  • count (:string) - Count text, e.g. '25 of 250'. Defaults to nil.
  • align (:string) - Defaults to nil.Must be one of nil, "start", "center", or "end".
  • class (:string) - Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["phx-click"].

Slots

  • inner_block

pager(assigns)

Renders a pagination control.

Examples

<.pager page={@page} total_pages={@total_pages} on_previous="prev_page" on_next="next_page" />

<.pager page={3} total_pages={10} on_previous="prev" on_next="next" on_first="first" on_last="last" />

<.pager page={1} total_pages={10} align="end" info_text="Showing 1-25 of 250" />

Attributes

  • page (:integer) - Defaults to 1.
  • total_pages (:integer) - Defaults to 1.
  • align (:string) - Defaults to nil.Must be one of nil, "start", "center", or "end".
  • show_page_input (:boolean) - Show page number input. Defaults to true.
  • show_info (:boolean) - Show info section. Defaults to true.
  • info_text (:string) - Custom info text (overrides page X of Y). Defaults to nil.
  • on_previous (:string) - Event for previous button. Defaults to "prev-page".
  • on_next (:string) - Event for next button. Defaults to "next-page".
  • on_first (:string) - Event for first button (nil = hidden). Defaults to nil.
  • on_last (:string) - Event for last button (nil = hidden). Defaults to nil.
  • on_page_change (:string) - Event for page input change. Defaults to nil.
  • icon_first (:string) - First page button icon. Defaults to "&#171;".
  • icon_previous (:string) - Previous page button icon. Defaults to "&#8249;".
  • icon_next (:string) - Next page button icon. Defaults to "&#8250;".
  • icon_last (:string) - Last page button icon. Defaults to "&#187;".
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • controls - Custom controls (overrides default buttons).
  • info - Custom info content (overrides default info).