1.1.2 • Published 22 days ago

@devrue/rn-select v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
22 days ago

npm version ci workflow

React Native Select

React Native Select is a select component for React Native that is compatible with both mobile and web platforms. It is entirely written in TypeScript and comes with features such as being searchable, multiselect, and creatable.

Why another select component? I wanted something approachable, highly customizable and that felt just a wee bit native on all platforms. Those wants led me to create this and soon after share it with the community.

Demo

MobileWeb

Installation

yarn add @devrue/rn-select

or

npm install @devrue/rn-select

Usage

import { Select } from '@devrue/rn-select';

export function App() {
  const pets = [
    ['cat', 'Cat'],
    ['dog', 'Dog'],
    ['horse', 'Horse'],
    ['fish', 'Fish'],
  ]
  return <Select options={pets} />
}

Props

Single Select Props

PropDescriptionDefault
valueCurrently selected value stringNone
onChangeValueCallback when value changes. Receives stringNone

Multi Select Props

PropDescriptionDefault
multiFlag indicating multiselect modetrue
valueCurrently selected values Array<string>None
onChangeValueCallback when values change. Receives Array<string>None

Common Props

PropDescriptionDefault
placeholderPlaceholder text when no option is selectedNone
listTitleTitle for the options listNone
searchPlaceholderPlaceholder text for the search inputNone
searchPlaceholderTextColorText color for the search input placeholderNone
showSelectionCountFlag to show the count of selected itemstrue
optionsArray of options (Array<[key, value]>)Required
reverseFlag to reverse option and check mark positonfalse
selectionEffectColorColor for selection effectNone
optionsScrollIndicatorFlag to show scroll indicator for optionstrue
emptyOptionsPlaceholderPlaceholder text when options is emptytrue
emptySearchMsgMessage when search results are empty"No options"
valueCurrently selected value(s) string or Array<string>None
clearableFlag to enable clearing of selectiontrue
disabledFlag to disable the componentfalse
searchableFlag to enable searchingtrue
createableFlag to enable creating new itemsfalse
avoidBottomAvoid options from being hidden by browser window height or positionNone
onCreateItemCallback when a new item is createdNone
onChangeInputCallback when input value changesNone
renderAnchorCustom rendering for anchor componentNone
renderSearchCustom rendering for search componentNone
renderOptionCustom rendering for option componentNone
optionDividerCustom component for option dividerNone
selectStyleStyles for the select containerNone
selectPlaceholderTextStyleStyles for the placeholder textNone
selectTextStyleStyles for the select textNone
selectPillTextStyleStyles for the select pill textNone
selectPillRemoveContainerStyleStyles for the select pill remove containerNone
selectPillRemoveIconStyleStyles for the select pill remove iconNone
selectIconStyleStyles for the select icon (close & expand)None
searchContainerStyleStyles for the search containerNone
searchInputStyleStyles for the search inputNone
searchBackIconStyleStyles for the search back iconNone
searchClearIconStyleStyles for the search clear iconNone
statsTextStyleStyles for the stats textNone
optionListContainerStyleStyles for the options list containerNone
optionListStyleStyles for the options listNone
optionContainerStyleStyles for the option containerNone
optionTextStyleStyles for the option textNone
optionCheckColorsColors for option checkmarkNone
emptyTextStyleStyles for the empty textNone

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library