简体   繁体   中英

Is it possible to use React Select multi with no options/dropdown?

I basically want to use react select with no options/dropdown (just like an input field) but use the multi feature available in select

so I figured something like this:

<Select
  components={{ DropdownIndicator: () => null }}
  placeholder="Start typing to enter options"
  multi
/>

but this just gives me no options in the dropdown

how can I achieve this?

You might try adding an options={[]} prop, at least we achieve what you say doing that in our UI doing that. Adding some sort of "Add value" button input in the dropdown that enables the isMulti and then just passing the empty options.

https://react-select.com/props#prop-types

According to the oficial documentation, it is a valid approach.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM