etui/widgets/paginator

Types

pub type Paginator {
  Paginator(
    current: Int,
    total: Int,
    page_size: Int,
    style: PaginatorStyle,
    active_char: String,
    inactive_char: String,
    fg: style.Color,
    bg: style.Color,
  )
}

Constructors

pub type PaginatorStyle {
  Dots
  Arabic
}

Constructors

  • Dots
  • Arabic

Values

pub fn go_to(p: Paginator, page: Int) -> Paginator

Jump to a specific page, clamped to [0, total - 1].

pub fn next_page(p: Paginator) -> Paginator

Next page, clamped to last.

pub fn paginator_new(total: Int) -> Paginator

New paginator. total is clamped to at least 1. Starts on page 0.

pub fn prev_page(p: Paginator) -> Paginator

Previous page, clamped to 0.

pub fn set_item_count(p: Paginator, items: Int) -> Paginator

Recompute total from an item count and the current page_size. Clamps current so it stays in range.

pub fn slice(items: List(a), p: Paginator) -> List(a)

Pull the items belonging to the current page.

pub fn with_chars(
  p: Paginator,
  active: String,
  inactive: String,
) -> Paginator
pub fn with_colors(
  p: Paginator,
  fg: style.Color,
  bg: style.Color,
) -> Paginator
pub fn with_page_size(p: Paginator, n: Int) -> Paginator

Items per page (used by slice/2). Default 10.

Search Document