suiss/ui ยท Pattern
Picker
A single-choice picker that renders a custom Select on desktop and a native select on mobile.
Picker is an open-source pattern from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
Picker lets the user choose one option from a short list. On desktop it renders a suiss/ui Select. On mobile (below 48rem, via useIsMobile) it renders a NativeSelect, so the platform's own picker wheel or sheet appears. The same PickerItem markup drives both presentations.
Use it for form fields where the options are known and do not need search; for long lists, use SearchPicker.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
-
Add the pieces it builds on: Native Select, Select,
use-mobile. -
Copy and paste the following code into your project.
- Update the import paths to match your project setup.
Usage
Composition
Use the following composition to build a Picker:
Examples
With value
Set defaultValue to start with an initial value.
Sizes
Use the size prop to set the control height to sm or default.
Grouped
Wrap options in a PickerGroup with a label and divide groups with PickerSeparator. On mobile, groups become optgroup elements and separators are omitted. Set disabled on a PickerItem to disable one option.
Disabled
Set disabled to prevent opening and changing the value.
Invalid
Set aria-invalid to mark the field invalid and apply the error style.
Controlled
Control the value with value and onValueChange.
Accessibility
- The desktop trigger has the
comboboxrole and opens alistbox; the selected option hasaria-selected, and disabled options havearia-disabled. - Labelled groups are exposed as
groupelements named by their label. - Escape closes the desktop list without changing the value.
- On mobile the control is a native
select, with the platform's built-in keyboard and screen reader support.
API Reference
Picker
The root that renders the Select or native select and holds the value.
| Prop | Type | Default |
|---|---|---|
value | string | - |
defaultValue | string | - |
onValueChange | (value: string) => void | - |
placeholder | string | - |
items | PickerItemData[] | - |
size | "sm" | "default" | "default" |
id | string | - |
name | string | - |
disabled | boolean | - |
required | boolean | - |
className | string | - |
children | React.ReactNode | - |
aria-invalid | boolean | - |
aria-label | string | - |
aria-describedby | string | - |
The value is uncontrolled by default; use defaultValue, or value with onValueChange to control it. On mobile, placeholder is a disabled first option. id and className go to the trigger on desktop and to the native select on mobile. Give the picker an accessible name with aria-label or a Label that points at its id.
Picker collects the value and label of each PickerItem from its children so the desktop trigger can show the selected label. Pass items only when options are not rendered as direct or nested PickerItem elements. PickerGroup, PickerItem and PickerSeparator must be used inside Picker, or they throw. Each part sets a data-slot, such as picker or picker-item, for styling.
PickerGroup
Groups related options under an optional label.
| Prop | Type | Default |
|---|---|---|
label | string | - |
children | React.ReactNode | - |
PickerItem
A selectable option.
| Prop | Type | Default |
|---|---|---|
value | string | Required |
disabled | boolean | - |
children | React.ReactNode | - |
Web preview
Picker composes Select: a SelectTrigger showing the current value and a SelectContent popup with the options. The selected option shows a check mark.
Use it to choose one value from a short or grouped list in a form.
Installation
The CLI also adds what it builds on: Select.
-
Add the pieces it builds on: Select.
-
Copy and paste the following code into
components/patterns/picker.tsx:
- Update the import paths to match your project setup.
-
Add the pieces it builds on: Select.
-
Copy and paste the following code into
components/patterns/picker.tsx:
- Update the import paths to match your project setup.
-
Add the pieces it builds on: Select.
-
Copy and paste the following code into
components/patterns/picker.tsx:
- Update the import paths to match your project setup.
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Apply the Compose compiler plugin, enable Compose, set
compileSdkto 37 or higher andminSdkto 24 or higher, and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Examples
States
A small picker with a value, an invalid picker and a disabled picker.

Accessibility
- Give the picker an
accessibilityLabeloraccessibilityLabelledBy, since the trigger shows only the value.
API Reference
Picker
The root that renders the trigger and the options popup.
| Prop | Type | Default |
|---|---|---|
value | string | - |
defaultValue | string | - |
onValueChange | (value: string) => void | - |
placeholder | string | - |
items | PickerItemData[] | - |
size | "sm" | "default" | "default" |
disabled | boolean | - |
invalid | boolean | - |
className | string | - |
accessibilityLabel | string | - |
accessibilityLabelledBy | string | - |
children | React.ReactNode | - |
Use it uncontrolled with defaultValue, or controlled with value and onValueChange. placeholder shows while nothing is selected. List PickerItems as children, optionally inside PickerGroups separated by PickerSeparator. The picker collects the items from its children to show the selected label, or you can pass items directly as { value, label } pairs.
The popup fades in and out and respects the system reduce motion setting. On iOS it renders in a full-window overlay so it appears above native screens.
PickerGroup
Groups options under an optional label.
| Prop | Type | Default |
|---|---|---|
label | string | - |
children | React.ReactNode | - |
PickerItem
One selectable option.
| Prop | Type | Default |
|---|---|---|
value | string | Required |
disabled | boolean | - |
children | React.ReactNode | - |
OptionPicker
| Parameter | Type | Default |
|---|---|---|
selection | Binding<Value?> | - |
placeholder | LocalizedStringKey | "Select" |
size | Size | .default |
content | () -> Content | - |
OptionPickerItem
| Parameter | Type | Default |
|---|---|---|
_ย title | LocalizedStringKey | - |
value | Value | - |
verbatim | String | - |
Overloads: init(_:value:), init(verbatim:value:).
OptionPickerGroup
| Parameter | Type | Default |
|---|---|---|
_ย label | LocalizedStringKey? | nil |
content | () -> Content | - |
OptionPickerSeparator
Takes no parameters.
PickerItemData
| Parameter | Type | Default |
|---|---|---|
value | String | - |
label | String | - |
enabled | Boolean | true |
Picker
The root that renders the trigger and the options popup.
| Parameter | Type | Default |
|---|---|---|
value | String? | - |
onValueChange | (String) -> Unit | - |
modifier | Modifier | Modifier |
items | List<PickerItemData> | emptyList() |
placeholder | String | "" |
size | SelectSize | SelectSize.Default |
enabled | Boolean | true |
invalid | Boolean? | null |
content | (@Composable ColumnScope.() -> Unit)? | null |
PickerGroup
Groups options under an optional label.
| Parameter | Type | Default |
|---|---|---|
label | String? | null |
modifier | Modifier | Modifier |
content | @Composable ColumnScope.() -> Unit | - |
PickerItem
One selectable option.
| Parameter | Type | Default |
|---|---|---|
value | String | - |
text | String | - |
modifier | Modifier | Modifier |
enabled | Boolean | true |
PickerSeparator
Takes no parameters.
