Select
A dropdown that pops open, flips above the trigger when there's no room below, and checks off the selected option.
Prerequisites
Select renders its panel in a Modal and needs an icon set for the chevron and the check mark, on top of Reanimated and haptics.
npx expo install react-native-reanimated expo-haptics react-native-css @hugeicons/react-native @hugeicons/core-free-icons
Install
npx @rslab/cli add select
Usage
import { Select } from '@/components/ui/Select';
const [plan, setPlan] = useState<string | null>(null);
<Select
value={plan}
onChange={setPlan}
placeholder="Choose a plan"
options={[
{ label: 'Solo', value: 'solo' },
{ label: 'Team', value: 'team' },
{ label: 'Enterprise', value: 'enterprise' },
]}
/>;Near the bottom of the screen, the panel opens upward on its own, no prop needed:
<Select
value={region}
onChange={setRegion}
disabled={loadingRegions}
options={regions}
/>Props
PropTypeDefault
valueTnull-Controlled selected value, or null before a choice is made.
onChange(value: T) => void-options{ label: string; value: T }[]-Generic over the value’s string literal type.
placeholder?string'Select…'Shown in place of a label while value is null.
disabled?booleanfalseFades the trigger and blocks opening.
className?string-Extend or override the trigger’s outer wrapper.
See exactly how this works with an RSLAB subscription.
Get Pro