React Native · Components
Select
Select box.
Live example
The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.
Preview
Code
Events
- Events appear here when you interact with the preview.
SelectField: etiket, zorunlu alan ve form
Import
Select
componentSelect box. On phones a themed panel opens from the bottom (rows tall enough for comfortable thumb taps, closes by pulling down and with the back button); on tablets a list opens below the box. The operating system's picker is not used; it looks the same on iOS and Android.
- Options can be plain text,
{ value, label, icon, description, disabled }or{ group, items }. Search ignores diacritic differences (including Turkish characters) and highlights the match. - Long lists are virtual;
itemscan be a Promise or a function, andloadItemsdoes server-side search and pagination. - Multiple selection with
multiple.
Examples
SelectItem
interfaceAn option inside Select (same as web).
| Name | Type | Description |
|---|---|---|
value | string | The value used with value/onValueChange. |
label? | ReactNode | Display text. Defaults to value. |
icon? | IconProp | Icon before the text. |
description? | ReactNode | Small description under the text. |
disabled? | boolean | Cannot be selected. |
keywords? | readonly string[] | Extra words to match in search (e.g. a plate code). |
SelectGroup
interfaceOption group with a heading.
| Name | Type | Description |
|---|---|---|
group | ReactNode | Group heading. |
items | readonly (string | SelectItem)[] | Options in the group. |
SelectEntry
typeAn element of the items array: plain text, an option object or a group.
SelectPage
interfaceOne page of the loadItems response.
| Name | Type | Description |
|---|---|---|
items | readonly SelectEntry[] | Items on this page. |
hasMore? | boolean | Are there more pages? |
SelectLoadContext
interfaceInformation passed to loadItems.
| Name | Type | Description |
|---|---|---|
query | string | Search text (may be empty). |
page | number | Requested page; the first page is 0. |
signal | AbortSignal | Cancels the stale request when the search changes or the list closes. |
Source of the options: an array, a Promise or a function called once.
SelectLoader
typeLoader that searches and paginates on the server.
SingleSelectProps
interfaceSingle selection.
Extends: FieldProps
| Name | Type | Default | Description |
|---|---|---|---|
multiple? | false | Single selection. | |
value? | string | Selected value (controlled); "" is empty. | |
defaultValue? | string | Initial value. | |
onValueChange? | (value: string, item: SelectItem | undefined) => void | When the selection changes. | |
renderValue? | (item: SelectItem) => ReactNode | How the selected item looks in the box. | |
items? | SelectItemsSource | Options: an array, a Promise or a function called once. | |
loadItems? | SelectLoader | Function that searches on the server and fetches page by page (search waits 250 ms, the stale request is cancelled). | |
search? | boolean | "auto" | "auto" | Search box: "auto" with more than 20 options. |
searchPlaceholder? | string | the {@link UIProvider} `search` text | Placeholder of the search box. |
placeholder? | ReactNode | {@link UIProvider} `select` text | Text shown when nothing is selected. |
emptyMessage? | ReactNode | When there are no options or the search finds nothing. | |
icon? | IconProp | Icon at the start of the box. | |
clearable? | boolean | false | Button that clears the selection. |
open? | boolean | Is the list open, in controlled use? | |
defaultOpen? | boolean | false | Initially open? |
onOpenChange? | (open: boolean) => void | When the list opens or closes. | |
variant? | FieldVariant | "outline" | Field appearance. |
aria-label? | string | Screen reader name; give it when there is no visible label. | |
style? | StyleProp<ViewStyle> | Container style. |
MultiSelectProps
interfaceMultiple selection.
Extends: FieldProps
| Name | Type | Default | Description |
|---|---|---|---|
multiple | true | Multiple values can be selected; the list does not close on selection. | |
value? | readonly string[] | Selected values (controlled). | |
defaultValue? | readonly string[] | Initial values. | |
onValueChange? | (value: string[], items: SelectItem[]) => void | When the selection changes. | |
renderValue? | (items: SelectItem[]) => ReactNode | How the selected items look in the box. | |
items? | SelectItemsSource | Options: an array, a Promise or a function called once. | |
loadItems? | SelectLoader | Function that searches on the server and fetches page by page (search waits 250 ms, the stale request is cancelled). | |
search? | boolean | "auto" | "auto" | Search box: "auto" with more than 20 options. |
searchPlaceholder? | string | the {@link UIProvider} `search` text | Placeholder of the search box. |
placeholder? | ReactNode | {@link UIProvider} `select` text | Text shown when nothing is selected. |
emptyMessage? | ReactNode | When there are no options or the search finds nothing. | |
icon? | IconProp | Icon at the start of the box. | |
clearable? | boolean | false | Button that clears the selection. |
open? | boolean | Is the list open, in controlled use? | |
defaultOpen? | boolean | false | Initially open? |
onOpenChange? | (open: boolean) => void | When the list opens or closes. | |
variant? | FieldVariant | "outline" | Field appearance. |
aria-label? | string | Screen reader name; give it when there is no visible label. | |
style? | StyleProp<ViewStyle> | Container style. |
SelectProps
typeSelect props (same names as web).
Extends: FieldProps
| Name | Type | Default | Description |
|---|---|---|---|
multiple? | false | true | Single selection. | |
value? | string | readonly string[] | Selected value (controlled); "" is empty. | |
defaultValue? | string | readonly string[] | Initial value. | |
onValueChange? | (value: string, item: SelectItem | undefined) => void | (value: string[], items: SelectItem[]) => void | When the selection changes. | |
renderValue? | (item: SelectItem) => ReactNode | (items: SelectItem[]) => ReactNode | How the selected item looks in the box. | |
items? | SelectItemsSource | Options: an array, a Promise or a function called once. | |
loadItems? | SelectLoader | Function that searches on the server and fetches page by page (search waits 250 ms, the stale request is cancelled). | |
search? | boolean | "auto" | "auto" | Search box: "auto" with more than 20 options. |
searchPlaceholder? | string | the {@link UIProvider} `search` text | Placeholder of the search box. |
placeholder? | ReactNode | {@link UIProvider} `select` text | Text shown when nothing is selected. |
emptyMessage? | ReactNode | When there are no options or the search finds nothing. | |
icon? | IconProp | Icon at the start of the box. | |
clearable? | boolean | false | Button that clears the selection. |
open? | boolean | Is the list open, in controlled use? | |
defaultOpen? | boolean | false | Initially open? |
onOpenChange? | (open: boolean) => void | When the list opens or closes. | |
variant? | FieldVariant | "outline" | Field appearance. |
aria-label? | string | Screen reader name; give it when there is no visible label. | |
style? | StyleProp<ViewStyle> | Container style. |