Skip to main content

Select

Select renders a dropdown list for picking one or more items. It supports grouping, multi-selection, labels, and captions.

Import​

import { Select, SelectGroup, SelectItem } from '@ui-kitten/components';

Basic Usage​

import React, { useState } from 'react';
import { Layout, Select, SelectGroup, SelectItem, IndexPath } from '@ui-kitten/components';

const SelectExample = () => {
const [selectedIndex, setSelectedIndex] = useState(new IndexPath(0));

const options = ['Option 1', 'Option 2', 'Option 3'];
const displayValue = options[selectedIndex.row];

return (
<Layout style={{ flex: 1, padding: 16 }}>
<Select
label="Choose an option"
caption="Pick one from the list"
selectedIndex={selectedIndex}
onSelect={(index) => setSelectedIndex(index)}
value={displayValue}
>
{options.map((title, index) => (
<SelectItem key={index} title={title} />
))}
</Select>
</Layout>
);
};

Props​

Select​

PropertyTypeDefaultDescription
selectedIndexIndexPath | IndexPath[]undefinedThe selected item index (or array for multi-select).
onSelect(index: IndexPath | IndexPath[]) => void-Called when an item is selected.
placeholderstring | number | (props) => ReactElement'Select Option'Placeholder displayed when no item is selected.
labelstring | number | (props) => ReactElementundefinedLabel displayed above the select.
captionstring | number | (props) => ReactElementundefinedCaption displayed below the select.
multiSelectbooleanfalseWhether multiple items can be selected.
valuestring | number | (props) => ReactElementundefinedDisplay value text or render function.
childrenSelectItem[] | SelectGroup[]-Select items and groups.
accessoryLeft(props) => ReactElementundefinedRender function for the accessory shown at the start of the control.
accessoryRight(props) => ReactElementundefinedRender function for the accessory shown at the end of the control. Defaults to the chevron.
status'basic' | 'primary' | 'success' | 'info' | 'warning' | 'danger' | 'control''basic'Status of the control.
size'small' | 'medium' | 'large''medium'Size of the control.
appearance'default''default'Appearance defined in the Eva mapping.

Select exposes an imperative API through a ref typed as SelectRef, with focus(), blur(), isFocused() and clear().

SelectGroup​

PropertyTypeDefaultDescription
titlestring | number | (props) => ReactElement-Group title text or render function.
childrenSelectItem[]-Nested select items.
accessoryLeft(props) => ReactElementundefinedRender function for the accessory shown at the start of the title.
accessoryRight(props) => ReactElementundefinedRender function for the accessory shown at the end of the title.

SelectItem​

PropertyTypeDefaultDescription
titlestring | number | (props) => ReactElement-Item title text or render function.
accessoryLeft(props) => ReactElementundefinedRender function for the left accessory.
accessoryRight(props) => ReactElementundefinedRender function for the right accessory.
selectedbooleanfalseWhether the item is rendered as selected. Managed by Select.
appearance'default' | 'grouped''default'Appearance defined in the Eva mapping. grouped is applied to items inside a SelectGroup.

SelectItem also accepts all standard React Native TouchableOpacity props, including disabled. Its onPress is called with (descriptor: SelectItemDescriptor, event?: GestureResponderEvent) rather than the plain press event.

Storybook​

Live examples coming soon via Storybook.