Skip to main content

List

A token-driven wrapper around React Native's FlatList, with a default separator, empty state, and padding shorthands. It accepts all standard FlatList props (data, renderItem, keyExtractor, etc.) alongside a few extras.

Basic usage

Almond
Cashew
Pistachio
Walnut
<List
data={[
{ id: '1', name: 'Almond' },
{ id: '2', name: 'Cashew' },
{ id: '3', name: 'Pistachio' },
{ id: '4', name: 'Walnut' },
]}
keyExtractor={item => item.id}
renderItem={({ item }) => (
<Box py="s-2">
<Text variant="body">{item.name}</Text>
</Box>
)}
/>

No separator & empty state

Nothing here yet
<List
data={[]}
keyExtractor={(_, index) => String(index)}
renderItem={() => null}
showSeparator={false}
emptyState={
<Box py="s-4" align="center">
<Text variant="body" color="textMuted">
Nothing here yet
</Text>
</Box>
}
/>

Props

List accepts all FlatList<TItem> props except ItemSeparatorComponent, ListEmptyComponent, and contentContainerStyle, plus:

PropTypeDefaultDescription
showSeparatorbooleantrueShow the default token-driven separator between items.
separatorColorTVajraColors'border'Color of the default separator.
emptyStateReactNodeRendered in place of the list when data is empty.
pTSpacingTokenContent container padding.
pxTSpacingTokenContent container horizontal padding.
pyTSpacingTokenContent container vertical padding.
testIDstringTest identifier.

Also accepts all FlatList props (data, renderItem, keyExtractor, horizontal, onEndReached, etc.).