Skip to content

Modern Tui TuiList

Paul Squires edited this page Oct 26, 2026 · 7 revisions

Home › Terminal TUI Library › Core Widgets › TuiList

TuiList

Draws a scrolling list the user moves through with the arrow keys.

Syntax

type TuiList extends TuiWidget
    as TuiStringArray items
    as TuiListState ptr state
    as TuiStyle normal, selected
    as ustring selectPrefix
    as boolean wrapSelection
end type

Description

A scrolling selection list. The state is CALLER-OWNED so the widget can be a throwaway value while the scroll position survives. Keys: up, down, page up, page down, home, end.

Example

#import "std/numeric"
#import "std/tui"
using tui, numeric

dim as TuiListState st
dim as TuiList lst
lst.items.Push( "alpha" ) : lst.items.Push( "beta" ) : lst.items.Push( "gamma" )
lst.state = @st
lst.selectPrefix = "> "
lst.wrapSelection = TRUE
lst.SetFocused( TRUE )

dim as TuiEvent e
e.kind = TUIEVENT_KEY : e.key.code = TUIKEY_END
lst.HandleEvent( e )
print st.selected                 '' 2

e.key.code = TUIKEY_DOWN          '' wrapSelection is on
lst.HandleEvent( e )
print st.selected                 '' 0

See also

TuiBlock TuiBlock.AddTitle TuiBorderGlyphs TuiTitleOf TuiListState TuiTable
TuiBlock.Inner TuiBorderSet TuiTitle TuiParagraph TuiRow TuiTableState

Library: Terminal TUI Library
Category: Terminal TUI Library
Documented under: Core Widgets
Working examples: hello.tiko · form.tiko · dashboard.tiko


Home · Keyword Index

Clone this wiki locally