Skip to content

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):

KeyAction
↑ / kMove selection up
↓ / jMove selection down
ggJump to first item
GJump to last item
EnterConfirm selection
<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])}
/>

PropertyTypeDescription
countnumberTotal number of items
defaultSelectedIndex?numberInitial index for uncontrolled mode
disabledIndices?Set<number>Set of disabled indices that are skipped during navigation
focusable?booleanWhether the list is focusable (default: true)
onSelect?(index) => voidCallback when enter is pressed on selected item
onSelectionChange?(index) => voidCallback when selected index should change
renderItem(info) => ReactNodeRender function for each item
selectedIndex?numberControlled selected index
style?StyleOuter box style

Information passed to each item’s render function.

PropertyTypeDescription
focusedbooleanWhether the List component itself has focus.
indexnumberZero-based index of this item.
selectedbooleanWhether this item is currently selected (highlighted).

Handle for List — exposes selected index

blur(): void;

Programmatically blur (unfocus) this element

void

FocusableHandle.blur


focus(): void;

Programmatically focus this element

void

FocusableHandle.focus


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.

ParameterTypeDescription
options?ScrollIntoViewOptionsAlignment options (default: { block: "nearest" })

void

const inputRef = useRef<InputHandle>(null);
// Minimal scroll — just enough to make it visible
inputRef.current?.scrollIntoView();
// Center the element in the viewport
inputRef.current?.scrollIntoView({ block: "center" });

FocusableHandle.scrollIntoView

PropertyModifierTypeDescriptionInherited from
isFocusedreadonlybooleanWhether this element is currently focusedFocusableHandle.isFocused
selectedIndexreadonlynumberCurrently selected index-