This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 54).
A Jetpack Compose Picker component for selecting options from a list.
A picker component that allows users to select from a list of options with different display styles.
Installation
- npx expo install @expo/uiIf you are installing this in an existing React Native app, make sure to install expo in your project.
Radio picker
import { Picker } from '@expo/ui/jetpack-compose'; <Picker options={['$', '$$', '$$$', '$$$$']} selectedIndex={selectedIndex} onOptionSelected={({ nativeEvent: { index } }) => { setSelectedIndex(index); }} variant="radio" />
See Official Jetpack Compose documentation for more information.
Segmented picker
import { Picker } from '@expo/ui/jetpack-compose'; <Picker options={['$', '$$', '$$$', '$$$$']} selectedIndex={selectedIndex} onOptionSelected={({ nativeEvent: { index } }) => { setSelectedIndex(index); }} variant="segmented" />
See Official Jetpack Compose documentation for more information.
API
Component
Type: React.Element<PickerProps>
Displays a native picker component. Depending on the variant it can be a segmented button, an inline picker, a list of choices or a radio button.
(event: {
nativeEvent: {
index: number,
label: string
}
}) => voidCallback function that is called when an option is selected.
unionThe index of the currently selected option.
Acceptable values are: number | null
string • Default: 'segmented'The variant of the picker, which determines its appearance and behavior.
The 'wheel', 'inline', 'palette' and 'menu' variants are iOS only, the 'radio' variant is Android only. The 'inline' variant can only be used inside sections or lists. The 'palette' variant displays differently inside menus.
Acceptable values are: 'segmented' | 'radio'
Types
Colors for picker's core elements.
| Property | Type | Description |
|---|---|---|
| activeBorderColor(optional) | string | - |
| activeContainerColor(optional) | string | - |
| activeContentColor(optional) | string | - |
| disabledActiveBorderColor(optional) | string | - |
| disabledActiveContainerColor(optional) | string | - |
| disabledActiveContentColor(optional) | string | - |
| disabledInactiveBorderColor(optional) | string | - |
| disabledInactiveContainerColor(optional) | string | - |
| disabledInactiveContentColor(optional) | string | - |
| inactiveBorderColor(optional) | string | - |
| inactiveContainerColor(optional) | string | - |
| inactiveContentColor(optional) | string | - |