howdy/ui/pagination

Pagination: links to the previous, next and nearby pages of a list.

pagination.pagination(words.english(), current: 4, total: 12, href: fn(page) {
  "/orders?page=" <> int.to_string(page)
})

The first and last pages and those next to the current one are always shown; the gaps between are marked with an ellipsis. Pages are counted from 1. Each link is an ordinary <a>, so it works without scripts; in a live view use live_pagination to get attributes such as a click handler or live.navigate instead of an href. words name the links and write the page numbers; see howdy/ui/words.

Values

pub fn classes() -> List(css.Class)

Every class this module uses, for howdy/ui/export.

pub fn ellipsis_class() -> css.Class
pub fn link_class() -> css.Class
pub fn list_class() -> css.Class
pub fn live_pagination(
  words words: words.Words,
  current current: Int,
  total total: Int,
  attributes attributes: fn(Int) -> List(attribute.Attribute(msg)),
) -> element.Element(msg)

Like pagination, with the attributes of each page’s <a> chosen by attributes.

pub fn nav_class() -> css.Class
pub fn pagination(
  words words: words.Words,
  current current: Int,
  total total: Int,
  href href: fn(Int) -> String,
) -> element.Element(msg)

Links to pages 1 to total, with current marked as the current page.

✨ Search Document