Khan / react-multi-select

A multiple select component for React
MIT License
184 stars 97 forks source link

Adding Image to the label #65

Open lelisloisBen opened 4 years ago

lelisloisBen commented 4 years ago

Hi, I'm trying to add an image in front of each option, my array of options look like that:

const icons = [ { img: mbaltimeter, label: "altimeter", value: "altimeter" }, { img: mbball, label: "ball", value: "ball" }, { img: mbbatton, label: "batton", value: "batton" }, { img: mbbike, label: "bike", value: "bike" }, ]

as you can see I have Img holding the variable that imports the image path, the label and the value. How can I show the image in each option in front of the label?

Thank you.

v-honcharenko commented 4 years ago

Hi @samirbenzada

You can achieve it using ItemRenderer prop. Check the examples in the storybook and here.