#MultiSelect, extra fields
21 messages · Page 1 of 1 (latest)
could you show some code/make a minimal codesandbox?
MultiSelect element
<MultiSelect
data={multiSelectData}
label="Products"
description="Select products"
/>
multiSelectData
const multiSelectData = [
{ label: "produc1", value: { itemID: 1, label: "product1"}}
]
MultiSelect is controlled (Left it out for better readability)
I map over the MultiSelect value and create a <TextArea> for each selected product
and I want to display the label of the product in the label of the TextArea
If you want I can also create a sandbox if it's not clear enough
I tried to fix it setting the valueComponent prop like this:
But there is no remove button
and re-coding that would seem silly
yeah that's your problem - do value: ${yourItemIdVariable}
label and value should he strings otherwise it will give you problems
you can make an object or map lookup, using your IDs to look up your full extended objects based on the ID value
I assume it's not possible to send the label prop to the MultiSelect value?
Because it only sends the value
no, they're separate
you can make label and value exactly the same if you want, you can also use string[] if you want them both to be the same
Ah okay
yeah I need both label and itemid, but I'll just search in the array of products for a matching itemID