List
const List: ForwardRefExoticComponent<ListProps & RefAttributes<ListHandle>>;Keyboard-navigable list with vim-style bindings.
Renders count items via a renderItem function, managing selection
state internally or through controlled props.
Keyboard shortcuts (when focused):
| Key | Action |
|---|---|
| ↑ / k | Move selection up |
| ↓ / j | Move selection down |
| gg | Jump to first item |
| G | Jump to last item |
| Enter | Confirm selection |
Example
Section titled “Example”<List count={items.length} renderItem={({ index, selected, focused }) => ( <Box style={{ bg: selected && focused ? "cyan" : undefined }}> <Text>{items[index].name}</Text> </Box> )} onSelect={(index) => console.log("Selected:", items[index])}/>Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
count | number | Total number of items |
defaultSelectedIndex? | number | Initial index for uncontrolled mode |
disabledIndices? | Set<number> | Set of disabled indices that are skipped during navigation |
focusable? | boolean | Whether the list is focusable (default: true) |
onSelect? | (index) => void | Callback when enter is pressed on selected item |
onSelectionChange? | (index) => void | Callback when selected index should change |
renderItem | (info) => ReactNode | Render function for each item |
selectedIndex? | number | Controlled selected index |
style? | Style | Outer box style |
ListItemInfo
Section titled “ListItemInfo”Information passed to each item’s render function.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
focused | boolean | Whether the List component itself has focus. |
index | number | Zero-based index of this item. |
selected | boolean | Whether this item is currently selected (highlighted). |
ListHandle
Section titled “ListHandle”Handle for List — exposes selected index
Extends
Section titled “Extends”Methods
Section titled “Methods”blur()
Section titled “blur()”blur(): void;Programmatically blur (unfocus) this element
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”focus()
Section titled “focus()”focus(): void;Programmatically focus this element
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”scrollIntoView()
Section titled “scrollIntoView()”scrollIntoView(options?): void;Scroll the nearest parent ScrollView to make this element visible.
Behaves like the DOM Element.scrollIntoView() method.
No-op if the element is not inside a ScrollView.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options? | ScrollIntoViewOptions | Alignment options (default: { block: "nearest" }) |
Returns
Section titled “Returns”void
Example
Section titled “Example”const inputRef = useRef<InputHandle>(null);
// Minimal scroll — just enough to make it visibleinputRef.current?.scrollIntoView();
// Center the element in the viewportinputRef.current?.scrollIntoView({ block: "center" });Inherited from
Section titled “Inherited from”FocusableHandle.scrollIntoView
Properties
Section titled “Properties”| Property | Modifier | Type | Description | Inherited from |
|---|---|---|---|---|
isFocused | readonly | boolean | Whether this element is currently focused | FocusableHandle.isFocused |
selectedIndex | readonly | number | Currently selected index | - |