Select

Forms

A bottom-sheet select picker with optional search filtering. Opens a Sheet containing a scrollable option list.

GitHub

Installation

bash
1
npx native-mate add select
component deps: sheet

Examples

#FAFAFA
Radius100%

Usage

tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { Select } from '~/components/ui/select'
import { useState } from 'react'

const [country, setCountry] = useState('')

const options = [
  { label: 'United States', value: 'us' },
  { label: 'United Kingdom', value: 'gb' },
  { label: 'Canada', value: 'ca' },
]

<Select
  label="Country"
  options={options}
  value={country}
  onValueChange={setCountry}
  searchable
  placeholder="Pick a country"
/>

Props

PropTypeDefaultDescription
optionsArray<{ label: string; value: string }>List of selectable options.
valuestringCurrently selected value.
onValueChange(value: string) => voidCalled when the user picks an option.
placeholderstring"Select…"Placeholder text shown when no value is selected.
searchablebooleanfalseAdds a search input at the top of the picker sheet.
labelstringLabel rendered above the trigger.

Example

tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { useState } from 'react'
import { Select } from '~/components/ui/select'
import { View } from 'react-native'

const CURRENCIES = [
  { label: 'US Dollar (USD)', value: 'usd' },
  { label: 'Euro (EUR)', value: 'eur' },
  { label: 'British Pound (GBP)', value: 'gbp' },
  { label: 'Japanese Yen (JPY)', value: 'jpy' },
  { label: 'Indian Rupee (INR)', value: 'inr' },
]

export function SelectExample() {
  const [currency, setCurrency] = useState('')

  return (
    <View style={{ padding: 16 }}>
      <Select
        label="Currency"
        options={CURRENCIES}
        value={currency}
        onValueChange={setCurrency}
        searchable
        placeholder="Select currency"
      />
    </View>
  )
}