SelectList
SelectList is the searchable React Native list inside SelectPicker, as a standalone inline component. Use it in settings screens, onboarding steps, or your own sheets and modals.
import { SelectList } from '@elik56a/react-native-pickers';
Result
Loading...
Live Editor
import { useState } from 'react'; import { View } from 'react-native'; import { SelectList } from '@elik56a/react-native-pickers'; const themes = [ { label: 'System', value: 'system', description: 'Follow the device setting' }, { label: 'Light', value: 'light' }, { label: 'Dark', value: 'dark' }, ]; export default function Example() { const [mode, setMode] = useState<string | null>('system'); return ( <View style={{ borderWidth: 1, borderColor: '#E8E4DC', borderRadius: 16, paddingVertical: 8 }}> <SelectList options={themes} value={mode} onChange={setMode} /> </View> ); }
Try the propsβ
<SelectList
options={countries}
value={value}
onChange={setValue}
searchable
/>
Multiple, with searchβ
Result
Loading...
Live Editor
import { useState } from 'react'; import { SelectList } from '@elik56a/react-native-pickers'; const toppings = ['Mozzarella', 'Basil', 'Mushrooms', 'Olives', 'Pepperoni', 'JalapeΓ±os', 'Pineapple', 'Onion', 'Ham', 'Rocket'].map((t) => ({ label: t, value: t, group: ['Pepperoni', 'Ham'].includes(t) ? 'Meat' : 'Veggie', })); export default function Example() { const [picked, setPicked] = useState<string[]>(['Mozzarella', 'Basil']); return <SelectList multiple options={toppings} value={picked} onChange={setPicked} maxSelected={5} listHeight={320} />; }
Behaviourβ
- Controlled only: pass
valueand update it inonChange. - In single mode, tapping an option calls
onChange(value, option), including when it's already selected (there's no deselect). - In multiple mode, taps toggle.
onChange(values, options)keeps selection order (appended at the end). - With
maxSelectedreached, unselected options become disabled until something is deselected. - Without
listHeight, the list grows with its content. Inside a scroll view or sheet, give it alistHeightso it scrolls on its own. - Search state is internal and resets when the list unmounts.
Propsβ
| Prop | Type | Default | Description |
|---|---|---|---|
options | ReadonlyArray<SelectOption<T>> | required | See options. |
multiple | boolean | false | Multi-select. |
value | T | null Β· T[] | β | Selection. |
onChange | (value: T, option) => void Β· (values: T[], options) => void | β | Single Β· multiple. |
maxSelected | number | β | Multiple only. |
searchable | boolean | options.length > 8 | Show the search field. |
query | string | β | Controlled search query, for filtering from your own input. Hides the built-in search field. |
searchPlaceholder | string | 'Search' | Search hint and its accessibility label. |
filterOption | (option: SelectOption<T>, query: string) => boolean | defaultFilter | Custom filter. |
renderOption | (info: SelectRenderOptionInfo<T>) => ReactNode | β | Custom row content. |
renderGroupHeader | (group: string, theme: PickerTheme) => ReactNode | β | Custom section header. |
emptyText | string | 'No results' | Empty-state text. |
showCheckmarks | boolean | true | β (single) / checkbox (multiple). |
isEqual | (a: T, b: T) => boolean | Object.is | Value equality. |
listHeight | number | β | Fixed height for the scrolling list. |
autoFocusSearch | boolean | false | Focus the search on mount. |
style | StyleProp<ViewStyle> | β | Container style. |
styles | SlotStyles<SelectSlot> | β | Slots below. |
theme | DeepPartial<PickerTheme> | β | Theme override. |
testID | string | β | Test ID. |
Slotsβ
| Slot | Element |
|---|---|
container | Outer view |
search | Search field wrapper |
searchInput | The TextInput |
list | The FlatList |
groupHeader / groupHeaderText | Section header |
option | Each row |
selectedOption | Selected rows (merged after option) |
optionLabel / selectedOptionLabel | Row label |
optionDescription | Second line |
check | β or checkbox |
empty / emptyText | Empty state |
Typesβ
interface SelectRenderOptionInfo<T> { option: SelectOption<T>; selected: boolean; disabled: boolean; theme: PickerTheme }
type SelectValueProps<T> =
| { multiple?: false; value?: T | null; onChange?: (value: T, option: SelectOption<T>) => void }
| { multiple: true; value?: T[]; onChange?: (value: T[], options: SelectOption<T>[]) => void; maxSelected?: number };