ui/table

Types

Keyboard messages for table component.

pub type Msg {
  MoveDown
  MoveUp
  MoveRight
  MoveLeft
  MoveRowStart
  MoveRowEnd
  MoveTableFirst
  MoveTableLast
  SelectRow
  SelectCell
  ToggleRowSelection
  ExtendSelectionDown
  ExtendSelectionUp
  EditCell
}

Constructors

  • MoveDown

    Move to next row (ArrowDown)

  • MoveUp

    Move to previous row (ArrowUp)

  • MoveRight

    Move to next cell (ArrowRight)

  • MoveLeft

    Move to previous cell (ArrowLeft)

  • MoveRowStart

    Move to first cell in row (Home)

  • MoveRowEnd

    Move to last cell in row (End)

  • MoveTableFirst

    Move to first cell in table (Ctrl+Home)

  • MoveTableLast

    Move to last cell in table (Ctrl+End)

  • SelectRow

    Select the currently focused row (Space)

  • SelectCell

    Select the currently focused cell (Enter)

  • ToggleRowSelection

    Toggle row selection (Ctrl+Space)

  • ExtendSelectionDown

    Extend selection with Shift+Arrow (multi-select mode)

  • ExtendSelectionUp

    Extend selection with Shift+Arrow (multi-select mode)

  • EditCell

    Enter cell editing mode (F2 or Enter for editable cells)

pub type SelectionMode {
  None
  Single
  Multiple
}

Constructors

  • None
  • Single
  • Multiple
pub type Size {
  Small
  Medium
  Large
}

Constructors

  • Small
  • Medium
  • Large
pub type Variant {
  Default
  Bordered
}

Constructors

  • Default
  • Bordered

Values

pub fn aria_activedescendant(
  id: String,
) -> attribute.Attribute(a)

Attribute to indicate the currently active descendant.

pub fn aria_label(label: String) -> attribute.Attribute(a)
pub fn aria_sort(sort: String) -> attribute.Attribute(a)

Attribute to indicate sort direction.

pub fn keymap(
  key_event: keyboard.KeyEvent,
  multi_select: Bool,
  editable: Bool,
) -> option.Option(Msg)

Keymap for table keyboard navigation. Follows WAI-ARIA grid pattern for tables:

  • ArrowDown: Move to next row
  • ArrowUp: Move to previous row
  • ArrowRight: Move to next cell
  • ArrowLeft: Move to previous cell
  • Home: Move to first cell in row
  • End: Move to last cell in row
  • Ctrl+Home: Move to first cell in table
  • Ctrl+End: Move to last cell in table
  • Space: Select focused row
  • Ctrl+Space: Toggle row selection
  • Enter: Select cell or enter edit mode
  • F2: Enter cell edit mode (for editable tables)
pub fn size(s: Size) -> attribute.Attribute(a)
pub fn table(
  attributes: List(attribute.Attribute(a)),
  children: List(element.Element(a)),
) -> element.Element(a)
pub fn table_body(
  attributes: List(attribute.Attribute(a)),
  children: List(element.Element(a)),
) -> element.Element(a)
pub fn table_caption(
  attributes: List(attribute.Attribute(a)),
  children: List(element.Element(a)),
) -> element.Element(a)
pub fn table_cell(
  attributes: List(attribute.Attribute(a)),
  children: List(element.Element(a)),
) -> element.Element(a)
pub fn table_cell_element_id(row: Int, col: Int) -> String

Get the element ID for a table cell at the given row and column.

pub fn table_column_header(
  attributes: List(attribute.Attribute(a)),
  children: List(element.Element(a)),
) -> element.Element(a)
pub fn table_column_header_element_id(col: Int) -> String

Get the element ID for a table column header at the given index.

pub fn table_head_cell(
  attributes: List(attribute.Attribute(a)),
  children: List(element.Element(a)),
) -> element.Element(a)
pub fn table_header(
  attributes: List(attribute.Attribute(a)),
  children: List(element.Element(a)),
) -> element.Element(a)
pub fn table_header_row(
  attributes: List(attribute.Attribute(a)),
  children: List(element.Element(a)),
) -> element.Element(a)
pub fn table_row(
  attributes: List(attribute.Attribute(a)),
  children: List(element.Element(a)),
) -> element.Element(a)
pub fn table_row_element_id(row: Int) -> String

Get the element ID for a table row at the given index.

Search Document