Open lelisloisBen opened 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.
Hi @samirbenzada
You can achieve it using ItemRenderer prop. Check the examples in the storybook and here.
ItemRenderer
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.