List
input
List: a scrollable, selectable list of items
Terminal
$termuijs render list
Installation
$ bunx termuijs add list
Copies the source into src/components/list/ and installs @termuijs/core, @termuijs/widgets.
Usage
ts
import { List } from '@termuijs/widgets'ts
new List(itemsOrProps: ListItem[] | ListProps, style: Partial<Style> = {}, onSelect?: (item: ListItem, index: number) => void,)API Reference
List
| Prop | Type | Required | Description |
|---|---|---|---|
items | ListItem[] | optional | — |
style | Partial<Style> | optional | — |
onSelect | (item: ListItem, index: number) => void | optional | — |
state | ListState | optional | External state object – if provided, List reads/writes selection through it |
onStateChange | (state: ListState) => void | optional | Called whenever selection or scroll changes |
emptyMessage | string | optional | Message to display when the list is empty |
reorderable | boolean | optional | Allow items to be reordered via moveItem() |