gleamtea/table

A bubble: a scrollable, row-selectable data table.

Types

A column: a #(title, width) pair.

pub type Column =
  #(String, Int)

An opaque table value.

pub type Table

Values

pub fn cursor(table: Table) -> Int

The current cursor (row) index.

pub fn new(
  columns columns: List(#(String, Int)),
  rows rows: List(List(String)),
  height height: Int,
) -> Table

A table with the given columns and rows, showing height rows at once. Each row is a list of cells, one per column.

pub fn selected_row(
  table: Table,
) -> Result(#(Int, List(String)), Nil)

The currently selected #(index, cells), or Error(Nil) if empty.

pub fn update(
  msg: msg,
  table: Table,
) -> #(Table, gleamtea.Cmd(msg))

Move the selected row with the arrows (or j/k) and scroll to follow.

pub fn view(table: Table) -> String

Render the header and the visible rows.

Search Document