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.
placeholderReactText | (props) => ReactElementundefinedPlaceholder displayed when no item is selected.
labelReactText | (props) => ReactElementundefinedLabel displayed above the select.
captionReactText | (props) => ReactElementundefinedCaption displayed below the select.
multiSelectbooleanfalseWhether multiple items can be selected.
valueReactText | (props) => ReactElementundefinedDisplay value text or render function.
childrenSelectItem[] | SelectGroup[]-Select items and groups.

SelectGroup

PropertyTypeDefaultDescription
titleReactText | (props) => ReactElement-Group title text or render function.
childrenSelectItem[]-Nested select items.

SelectItem

PropertyTypeDefaultDescription
titleReactText | (props) => ReactElement-Item title text or render function.
accessoryLeft(props) => ReactElementundefinedRender function for the left accessory.
accessoryRight(props) => ReactElementundefinedRender function for the right accessory.
disabledbooleanfalseWhether the item is disabled.

Storybook

Live examples coming soon via Storybook.