class

Term2::Components::List

Inherits Term2::Model < Reference < Object

Constructors

new(items : Array(Item) | Array(String) | Array(Tuple(String, String)), width : Int32 = 0, height : Int32 = 0)
Source
new(items : Array(String), width : Int32, height : Int32)

Convenience constructor for string items

Source

Class methods

default_filter(term : String, targets : Array(String)) : Array(Rank)

Fuzzy filter implementation using nucleoc library

Source
item(title : String, description : String = "")

Helper to create a DefaultItem easily

Source
items(ar : Array(Tuple(String, String))) : Array(Item)

Compatibility helper for older examples.

Source

Instance methods

add_item_front(item : Item) : Nil

Insert an item at the front of the list (Go: InsertItem(0, item)).

Source
additional_full_help_keys
Source
additional_full_help_keys=(additional_full_help_keys : Proc(Array(Key::Binding)))
Source
cursor_down

Move the cursor down by one item. Public for Bubble Tea parity (Go: CursorDown()).

Source
cursor_up

Move the cursor up by one item. Public for Bubble Tea parity (Go: CursorUp()).

Source
debug_mode?
Source
delegate
Source
delegate=(delegate : ItemDelegate)
Source
disable_quit_keybindings
Source
enumerator
Source
enumerator=(enumerator : Enumerators::Base)
Source
enumerator=(enumerator_type : T.class) forall T

Allow setting enumerators by type (e.g. List::Enumerators::Bullet), which matches how some ports express the Go API.

Source
filter_func
Source
filter_func=(filter_func : FilterFunc)
Source
filter_input
Source
filter_input=(filter_input : TextInput)
Source
filter_state
Source
filter_state=(state : FilterState)
Source
filter_text=(text : String)

[NEW] Helper to set filter text programmatically

Source
filter_value=(text : String)

[NEW] Alias for filter_input.value=

Source
filtering_enabled=(enabled : Bool)
Source
filtering_enabled?
Source
global_index

Index in the unfiltered list

Source
height
Source
height=(h : Int32)
Source
help
Source
help=(help : Help)
Source
index
Source
infinite_scrolling=(infinite_scrolling : Bool)
Source
infinite_scrolling?
Source
init

Init is the first function that will be called. It returns an optional initial command. To not perform an initial command return nil.

Source
item_name_plural
Source
item_name_plural=(item_name_plural : String)
Source
item_name_singular

[NEW] Status bar item naming

Source
item_name_singular=(item_name_singular : String)

[NEW] Status bar item naming

Source
items
Source
items=(items : Array(Item))
Source
key_map
Source
key_map=(key_map : KeyMap)
Source
matches_for_item(index : Int32) : Array(Int32)

[NEW] Helper to get matches for an item index (visual index)

Source
paginator
Source
paginator=(paginator : Paginator)
Source
reset_selected
Source
score_for_item(index : Int32) : UInt16 | Nil
Source
select(i : Int32) : Nil

Select an item in the currently visible page by its index. Public for Bubble Tea parity (Go: Select(i) where i is in VisibleItems()).

Source
selected_item

Current selected item

Source
set_filter_state(state : FilterState)

DEPRECATED Use #filter_state= instead

Source
set_items(items : Array(Item))

DEPRECATED Use #items= instead

Source
set_show_help(show : Bool)

DEPRECATED Use #show_help= instead

Source
show_filter=(show_filter : Bool)
Source
show_filter?
Source
show_help=(show : Bool)
Source
show_help?
Source
show_pagination=(show_pagination : Bool)
Source
show_pagination?
Source
show_status_bar=(show_status_bar : Bool)
Source
show_status_bar?
Source
show_title=(show_title : Bool)

--- Model State ---

Source
show_title?

--- Model State ---

Source
spinner
Source
spinner=(spinner : Spinner)
Source
status_message
Source
status_message=(status_message : String)
Source
status_view

[NEW] Expose status view for testing

Source
styles
Source
styles=(styles : Styles)
Source
title
Source
title=(title : String)
Source
toggle_filter

[NEW] Helper to toggle filter state (for testing/shortcuts)

Source
toggle_spinner
Source
update(msg : Msg) : Tuple(List, Cmd)

Update is called when a message is received. Use it to inspect the message and, in response, update the model and/or send a command.

Source
view

View renders the program's UI, which is just a string. The view is rendered after every Update.

Source
visible_items
Source
width
Source
width=(width : Int32)
Source

Nested types