ui/grid_list

Types

Keyboard messages for grid list component.

pub type Msg {
  MoveDown
  MoveUp
  MoveRight
  MoveLeft
  MoveRowStart
  MoveRowEnd
  MoveGridFirst
  MoveGridLast
  Select
  ExtendSelectionDown
  ExtendSelectionUp
  ExtendSelectionRight
  ExtendSelectionLeft
}

Constructors

  • MoveDown

    Move to next row (ArrowDown)

  • MoveUp

    Move to previous row (ArrowUp)

  • MoveRight

    Move to next column (ArrowRight)

  • MoveLeft

    Move to previous column (ArrowLeft)

  • MoveRowStart

    Move to first item in row (Home)

  • MoveRowEnd

    Move to last item in row (End)

  • MoveGridFirst

    Move to first item in grid (Ctrl+Home)

  • MoveGridLast

    Move to last item in grid (Ctrl+end)

  • Select

    Select the currently focused item (Enter or Space)

  • ExtendSelectionDown

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

  • ExtendSelectionUp

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

  • ExtendSelectionRight

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

  • ExtendSelectionLeft

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

pub type SelectionMode {
  None
  Single
  Multiple
}

Constructors

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

Constructors

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

Constructors

  • Default
  • Muted

Values

pub fn activedescendant(id: String) -> attribute.Attribute(a)
pub fn aria_label(label: String) -> attribute.Attribute(a)
pub fn grid_item_element_id(row: Int, col: Int) -> String

Get the element ID for a grid item at the given row and column.

pub fn grid_list(
  attributes: List(attribute.Attribute(a)),
  children: List(element.Element(a)),
) -> element.Element(a)
pub fn grid_list_item(
  attributes: List(attribute.Attribute(a)),
  children: List(element.Element(a)),
) -> element.Element(a)
pub fn grid_row_element_id(row: Int) -> String

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

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

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

  • ArrowDown: Move to next row
  • ArrowUp: Move to previous row
  • ArrowRight: Move to next column
  • ArrowLeft: Move to previous column
  • Home: Move to first item in row
  • End: Move to last item in row
  • Ctrl+Home: Move to first item in grid
  • Ctrl+End: Move to last item in grid
  • Enter/Space: Select focused item
  • Shift+Arrow: Extend selection (multi-select mode)
pub fn size(s: Size) -> attribute.Attribute(a)
Search Document