Inputs and selection
Select
pass safe-area insets to SelectContent
function SelectDemo() { const [triggerWidth, setTriggerWidth] = React.useState(0); const insets = useSafeAreaInsets(); const contentInsets = { top: insets.top, bottom: Platform.select({ ios: insets.bottom, android: insets.bottom + 24 }), left: 12, right: 12, }; return ( <Select> <SelectTrigger className="w-full" onLayout={(e) => setTriggerWidth(e.nativeEvent.layout.width)}> <SelectValue placeholder="Select a fruit" /> </SelectTrigger> {/* Match the trigger so the open list lines up with the field it belongs to. */} <SelectContent insets={contentInsets} style={triggerWidth ? { width: triggerWidth } : undefined}> <SelectGroup> <SelectLabel>Fruits</SelectLabel> {FRUITS.map((f) => ( <SelectItem key={f} label={f} value={f.toLowerCase()}> {f} </SelectItem> ))} </SelectGroup> </SelectContent> </Select> );}Usage
Pass safe-area insets to SelectContent so the sheet clears the home indicator.
API
<Select><SelectTrigger size?="sm|default|lg"><SelectValue /></SelectTrigger><SelectContent><SelectItem label value /></SelectContent></Select>Get it
Already in every copy of the native kit:
import { Select } from '@/components/ui/select';Details
- Exports
Select- Packages
- @rn-primitives/select@^1.5.2, lucide-react-native@^1.21.0, react-native-reanimated@4.5.1, react-native-screens@~4.26.0
- Installs with
- @halftone-native/icon, @halftone-native/lib-component-classes, @halftone-native/lib-palette-context, @halftone-native/lib-theme, @halftone-native/lib-utils, @halftone-native/text, rnr/native-only-animated-view
- Also searched as
- dropdown, picker, menu
- Registry JSON
- /r/native/select.json
<div className="grid w-full max-w-xs gap-2"> <Label htmlFor="demo-select">Role</Label> <Select defaultValue="editor"> <SelectTrigger id="demo-select" className="w-full"> <SelectValue /> </SelectTrigger> <SelectContent> <SelectItem value="owner">Owner</SelectItem> <SelectItem value="editor">Editor</SelectItem> <SelectItem value="viewer">Viewer</SelectItem> </SelectContent> </Select></div>API
<Select value onValueChange><SelectTrigger size?="sm|default|lg"><SelectValue /></SelectTrigger><SelectContent><SelectItem value /></SelectContent></Select>Get it
Already in every copy of the web kit:
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '@/components/ui/select';Details
- Exports
Select,SelectTrigger,SelectValue,SelectContent,SelectItem- Packages
- cn@^0.5.2, lucide-react@^1.52.0, radix-ui@^1.7.0
- Also searched as
- dropdown, picker
- Registry JSON
- /r/web/select.json
Agents: the whole registry is at /llms.txt.