Table of Contents

Class ListBuilder

Namespace
MiniTui
Assembly
MiniTui.dll

A bordered, scrollable list with a selection.

public class ListBuilder
Inheritance
ListBuilder
Inherited Members

Examples

Widget.List().Title("Files").Items(files, f => f.Name).State(selection).Focused().Draw(buf, area);

Methods

Block(BlockBuilder)

The border around the list. By default, a single-line border on all sides.

public ListBuilder Block(BlockBuilder block)

Parameters

block BlockBuilder

Returns

ListBuilder

Draw(Buffer, Rect)

Draw the list to the buffer.

public void Draw(Buffer buf, Rect area)

Parameters

buf Buffer
area Rect

Focused(bool)

Set whether the list is focused: the border and selection use the focused styles.

public ListBuilder Focused(bool focused = true)

Parameters

focused bool

Returns

ListBuilder

HighlightStyle(Style)

A style patched over the theme's selection style.

public ListBuilder HighlightStyle(Style style)

Parameters

style Style

Returns

ListBuilder

HighlightSymbol(string)

A marker drawn before the selected item, such as "> ". Other items are indented to match.

public ListBuilder HighlightSymbol(string symbol)

Parameters

symbol string

Returns

ListBuilder

Hover(Vec2?)

The pointer, usually Hover. Hover is patched over the row under it, unless it's the selected one (1.x spec §17.6).

public ListBuilder Hover(Vec2? position)

Parameters

position Vec2?

Returns

ListBuilder

Items(IReadOnlyList<string>)

The items to display.

public ListBuilder Items(IReadOnlyList<string> items)

Parameters

items IReadOnlyList<string>

Returns

ListBuilder

Items<T>(IReadOnlyList<T>, Func<T, Line>)

The items to display, formatted by format. Only visible items are formatted.

public ListBuilder Items<T>(IReadOnlyList<T> items, Func<T, Line> format)

Parameters

items IReadOnlyList<T>
format Func<T, Line>

Returns

ListBuilder

Type Parameters

T

ScrollOffset(int)

Set the scroll offset. The list adjusts it so the selection is visible.

public ListBuilder ScrollOffset(int offset)

Parameters

offset int

Returns

ListBuilder

Selected(int)

Set the selected item index.

public ListBuilder Selected(int index)

Parameters

index int

Returns

ListBuilder

ShowScrollInfo(bool)

Show or hide scroll position info in title (default: true).

public ListBuilder ShowScrollInfo(bool show = true)

Parameters

show bool

Returns

ListBuilder

State(SelectionState)

The selection. The list clamps it and scrolls to keep it visible.

public ListBuilder State(SelectionState state)

Parameters

state SelectionState

Returns

ListBuilder

Style(Style)

A style patched over the theme's text style.

public ListBuilder Style(Style style)

Parameters

style Style

Returns

ListBuilder

Title(string)

Set the list title. Scroll info such as [1-10 of 50] is appended unless turned off.

public ListBuilder Title(string title)

Parameters

title string

Returns

ListBuilder