# `Alaja.CLI.Pagination`
[🔗](https://github.com/Lorenzo-SF/alaja/blob/2.1.0/lib/alaja/cli/pagination.ex#L1)

Interactive pagination utilities for CLI output.

Provides functions for paginating long lists of items with keyboard navigation.

# `goto_page`

```elixir
@spec goto_page(non_neg_integer()) :: non_neg_integer() | :stay
```

Prompts for a page number and returns the 0-indexed page.
Returns `:stay` if invalid input.

# `handle_nav`

```elixir
@spec handle_nav(String.t(), non_neg_integer(), non_neg_integer()) ::
  non_neg_integer() | :quit
```

Handles navigation input and returns the next page number.
Returns `:quit` to exit pagination.

# `map_key`

```elixir
@spec map_key(String.t()) :: atom()
```

Maps a key to its navigation action.

# `nav_help`

```elixir
@spec nav_help(non_neg_integer(), non_neg_integer()) :: String.t()
```

Returns the navigation help message.

# `page_items`

```elixir
@spec page_items([any()], non_neg_integer(), pos_integer()) :: [any()]
```

Gets the slice of items for a given page.

# `read_key`

```elixir
@spec read_key(String.t()) :: String.t()
```

Reads a key from the user with a prompt.

# `total_pages`

```elixir
@spec total_pages(non_neg_integer(), pos_integer()) :: non_neg_integer()
```

Calculates the number of pages needed for a given total items and page size.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
