TermUI.Widget.List (TermUI v1.0.0)

View Source

A scrollable list widget with selection support.

List displays items and allows navigation with arrow keys. Supports single and multi-select modes.

This module uses the earlier TermUI.Widget namespace, accepts a props map directly, and must be embedded as an explicit state machine in the Elm root.

Usage

List.render(%{
  items: ["Apple", "Banana", "Cherry"],
  on_select: fn item -> IO.puts("Selected: #{item}") end
}, state, area)

Props

  • :items - List of items to display (required)
  • :on_select - Callback when selection changes
  • :multi_select - Enable multi-select mode (default: false)
  • :highlight_style - Style for selected items
  • :style - Default item style

Summary

Functions

Handles events for the list.

Handles messages to the list.

Initializes the list state.

Renders the list.

Functions

handle_event(arg1, state)

Handles events for the list.

handle_info(arg1, state)

Handles messages to the list.

init(props)

Initializes the list state.

render(state, area)

Renders the list.