gleamtea/list

A bubble: a scrollable, selectable list.

Types

An opaque list value.

pub type Listbox

Values

pub fn cursor(list: Listbox) -> Int

The current cursor index.

pub fn new(
  items items: List(String),
  title title: String,
  height height: Int,
) -> Listbox

A list of the given items, with a title and a number of visible rows.

pub fn selected(list: Listbox) -> Result(#(Int, String), Nil)

The #(index, item) currently under the cursor, or Error(Nil) if empty.

pub fn update(
  msg: msg,
  list: Listbox,
) -> #(Listbox, gleamtea.Cmd(msg))

Move the selection in response to a key; ignore everything else.

pub fn view(list: Listbox) -> String

Render the title and the visible window of items.

Search Document