class RatatuiRuby::Widgets::List

Displays a selectable list of items.

Users need to choose from options. Menus, file explorers, and selectors are everywhere. Implementing navigation, highlighting, and scrolling state from scratch is tedious.

This widget manages the list. It renders the items. It highlights the selection. It handles the scrolling window.

Use it to build main menus, navigation sidebars, or logs.

Examples

# Basic List
List.new(items: ["Item 1", "Item 2"])

# Navigation Menu
List.new(
  items: ["New Game", "Load Game", "Options", "Quit"],
  selected_index: 0,
  highlight_style: Style.new(bg: :blue),
  highlight_symbol: ">> "
)