Mobile › Inputs

Select

A field that opens a sheet of options and closes on a pick. It matches TextField, so a form keeps one look.

Installation

npx expo install plankui-mobile react-native-safe-area-context expo-haptics

Usage

import { Select } from "plankui-mobile";

const [country, setCountry] = useState<string | null>("pt");

<Select
  label="Country"
  value={country}
  onChange={setCountry}
  options={[
    { value: "pt", label: "Portugal" },
    { value: "es", label: "Spain" },
  ]}
/>

iOS and Android

iOS: A filled rounded field with a down chevron; options open in a sheet with a check on the chosen one.

Android: A Material outlined field; options open in a bottom sheet with Material list rows.

API reference

PropTypeDefaultDescription
labelstringAlways visible above the field, and the sheet's title.
valuestring | nullThe chosen option's value.
optionsSelectOption[]{ value, label, description?, disabled? }
onChange(value: string) => voidCalled with the picked value; the sheet then closes.
placeholderstring"Choose"Shown while nothing is chosen.
hintstring–Help text under the field.
errorstring–Shown instead of the hint, in red, and read out.
disabledbooleanfalseDims the field and blocks opening.