Select
Select Primitive
Demo
Presents a selection of options for the user to choose from, activated by a button.
Installation
Copy/paste the following code to ~/components/ui/select.tsx
:
Usage
Props
Select
Extends View
props
Prop | Type | Note |
---|---|---|
defaultValue | option: { value: string, label: string } | undefined | (optional) |
value | option: { value: string, label: string } | undefined | (optional) |
onValueChange | (option: { value: string, label: string } | undefined ) => void | (optional) |
onOpenChange | (value: boolean) => void | (optional) |
disabled | boolean | (optional) |
asChild | boolean | (optional) |
dir | ’ltr’ | ‘rtl’ | Web only (optional) |
name | string | Web only (optional) |
required | boolean | Web only (optional) |
SelectTrigger
Extends Pressable
props
Prop | Type | Note |
---|---|---|
asChild | boolean | (optional) |
SelectContent
Extends View
props
Prop | Type | Note |
---|---|---|
asChild | boolean | (optional) |
forceMount | true | undefined | (optional) |
alignOffset | number | (optional) |
insets | Insets | (optional) |
avoidCollisions | boolean | (optional) |
align | ’start’ | ‘center’ | ‘end’ | (optional) |
side | ’top’ | ‘bottom’ | (optional) |
sideOffset | number | (optional) |
disablePositioningStyle | boolean | Native Only (optional) |
position | ’popper’ | ‘item-aligned’ | undefined | Web Only (optional) |
SelectItem
Extends Pressable
props
Prop | Type | Note |
---|---|---|
value | string | |
label | string | |
closeOnPress | boolean | (optional) |
asChild | boolean | (optional) |
SelectGroup
Extends View
props
SelectLabel
Extends Text
props
SelectSeparator
Extends View
props
Prop | Type | Note |
---|---|---|
value | string | |
label | string | |
closeOnPress | boolean | (optional) |
asChild | boolean | (optional) |