Skip to main content

Select

Selects allow users to select from a single-option menu.

bpk-component-select

Backpack React Native select component.

Default

DayNight
bpk-component-select default iPhone 8 simulatorbpk-component-select default iPhone 8 simulator - dark mode
bpk-component-select default Google Pixel emulatorbpk-component-select default Google Pixel emulator - dark mode

Installation

Check the main Readme for a complete installation guide.

Usage

import React from 'react';
import { View, StyleSheet } from 'react-native';
import { spacingBase } from '@skyscanner/bpk-foundations-react-native/tokens/base.react.native';
import BpkSelect from 'backpack-react-native/bpk-component-select';

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    padding: spacingBase,
  }
});

export default () => (
  <View styles={styles.container>
    <BpkSelect
      onPress={openSelectUI}
      label="Select an Option"
    />
    <BpkSelect
      onPress={openSelectUI}
      label="Select an Option"
      valid={false}
      validationMessage="An option must be selected to continue"
    />
  </View>
);

Props

PropertyPropTypeRequiredDefault Value
onPressfunctrue-
disabledboolfalsefalse
focusedboolfalsefalse
labeloneOfType(string, element)falsenull
validoneOf(true, false, null)falsenull
validationMessagestringfalsenull