Reputation: 19
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
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)
Upvotes: 1
Views: 4153
Reputation: 509
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"
}
]
},
];
Upvotes: 1