简体   繁体   中英

Is there a way to group options in Input in react-select?

I am using react-select .

I need to group options in the input. The next values should be added to a specific group just like it is in "MenuList" component with groups

here what I need

https://prnt.sc/qybffp

Ideas on how to do this?

For now, I have only one idea to deal with the Multivalue component (each group is a separate Multivalue component). But not sure it's a good idea)

im not sure if you want to achieve something like this.

 const selected_options = [{ label: "Dark Colours", options: [{ label: "colour 1", value: "value1" }, { label: "colour 2", value: "value2" } ] }, { label: "Light Colours", options: [{ label: "colour 3", value: "value3" }, { label: "colour 4", value: "value4" } ] }, ];

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