Raxol.UI.Components.Selection.List (Raxol v0.4.0)

View Source

A component for displaying a selectable list of items.

Summary

Types

t()

State for the Selection.List component.

Functions

Handles events for the List component, such as keyboard and mouse input.

Initializes the List component state from props.

Renders the List component, displaying visible items.

Updates the List component state in response to messages.

Types

t()

@type t() :: %Raxol.UI.Components.Selection.List{
  focused: boolean(),
  height: non_neg_integer(),
  id: any(),
  item_renderer: (any() -> any()) | nil,
  items: list(),
  on_select: (any() -> any()) | nil,
  scroll_offset: non_neg_integer(),
  selected_index: non_neg_integer(),
  style: map(),
  width: non_neg_integer()
}

State for the Selection.List component.

  • :id - unique identifier
  • :items - list of items
  • :selected_index - index of selected item
  • :scroll_offset - scroll offset
  • :width - component width
  • :height - component height
  • :style - style map
  • :focused - whether the list is focused
  • :on_select - callback for selection
  • :item_renderer - function to render items

Functions

broadcast(msg)

command(cmd)

fetch(struct, key)

get_and_update(struct, key, fun)

handle_event(event, props, state)

@spec handle_event(term(), map(), t()) :: {t(), list()}

Handles events for the List component, such as keyboard and mouse input.

init(props)

@spec init(map()) :: t()

Initializes the List component state from props.

mount(state)

Callback implementation for Raxol.UI.Components.Base.Component.mount/1.

pop(struct, key)

render(state, props)

@spec render(t(), map()) :: any()

Renders the List component, displaying visible items.

schedule(msg, delay)

unmount(state)

Callback implementation for Raxol.UI.Components.Base.Component.unmount/1.

update(msg, state)

@spec update(term(), t()) :: {t(), list()}

Updates the List component state in response to messages.