Components/Select list

Select list

A lightweight single-selection list. Navigate with ↑↓ or j/k; optionally wrap the cursor at the boundaries. Embed it in a parent model to build menus and pickers.

Install the package

Every component ships in the single dart_tui package.

$dart pub add dart_tui
select list · dart_tui
Select list demo

SelectListModel

PropertyTypeDescription
itemsList<String>Non-empty list of options.
cursorintIndex of the highlighted item.
titleStringOptional heading above the list.
wrapboolWrap the cursor past the first/last item.
stylesListStylesStyling for the cursor, selected and normal rows.

Keybindings

↑ / kMove up
↓ / jMove down
enterSelect the highlighted item

Related