multiselect-react-dropdown
multiselect-react-dropdown copied to clipboard
Different colours of chips based on index and colour array
Hi,
Is there anyway to have the chips be of different colours based on the position in the selected list and an array of colours as in input?
I want this dropdown to be show the selected series on a chart and I need the chip background colour to be the same as the series graph
Can you provide a clear requirement for all scenarios and sample JSON format for the same?
What I done so far is to create a simple Graph in recharts and the user adds series via this drop down, which recharts renders each series in a different colour. Each series is a column in a dataset.
This is the current implementation. I to be able to have the first selected entry background chip (address_id ) to be same colour as the dots (Red) and the second chip (Store_id) to be green.
Something like this:
This could be done initially simply first by allowing the css json to have multiple colours for the background entry e.g.
{
chips:
{
background: red, blue, black ....;
}
....
or a more sophisticated implementation such as
{
chips:
{
background-color-callback : callback;
}
}
callback(selectPosition)
{
return colours[selectPosition];
}`
I hope that makes sense?