Skip to main content
Version: v0.7.x

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
/>
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 value and update it in onChange.
  • 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 maxSelected reached, unselected options become disabled until something is deselected.
  • Without listHeight, the list grows with its content. Inside a scroll view or sheet, give it a listHeight so it scrolls on its own.
  • Search state is internal and resets when the list unmounts.

Props​

PropTypeDefaultDescription
optionsReadonlyArray<SelectOption<T>>requiredSee options.
multiplebooleanfalseMulti-select.
valueT | null Β· T[]β€”Selection.
onChange(value: T, option) => void Β· (values: T[], options) => voidβ€”Single Β· multiple.
maxSelectednumberβ€”Multiple only.
searchablebooleanoptions.length > 8Show the search field.
querystringβ€”Controlled search query, for filtering from your own input. Hides the built-in search field.
searchPlaceholderstring'Search'Search hint and its accessibility label.
filterOption(option: SelectOption<T>, query: string) => booleandefaultFilterCustom filter.
renderOption(info: SelectRenderOptionInfo<T>) => ReactNodeβ€”Custom row content.
renderGroupHeader(group: string, theme: PickerTheme) => ReactNodeβ€”Custom section header.
emptyTextstring'No results'Empty-state text.
showCheckmarksbooleantrueβœ“ (single) / checkbox (multiple).
isEqual(a: T, b: T) => booleanObject.isValue equality.
listHeightnumberβ€”Fixed height for the scrolling list.
autoFocusSearchbooleanfalseFocus the search on mount.
styleStyleProp<ViewStyle>β€”Container style.
stylesSlotStyles<SelectSlot>β€”Slots below.
themeDeepPartial<PickerTheme>β€”Theme override.
testIDstringβ€”Test ID.

Slots​

SlotElement
containerOuter view
searchSearch field wrapper
searchInputThe TextInput
listThe FlatList
groupHeader / groupHeaderTextSection header
optionEach row
selectedOptionSelected rows (merged after option)
optionLabel / selectedOptionLabelRow label
optionDescriptionSecond line
checkβœ“ or checkbox
empty / emptyTextEmpty 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 };