I'm aiming to do a select element that has an icon next to it, like below. If the user clicks anywhere inside the "button" (including the icon), the option list should be displayed.
function Select() {
return (
<div>
<select>
<option value="">Choose an option</option>
<option value="dog">Dog</option>
<option value="cat">Cat</option>
<option value="hamster">Hamster</option>
</select>
<ImportedSvg />
</div>
)
}
I know there is a CSS way to solve this by having the image as a background to the select tag. As well as creating a custom option list.
However, I want the browser default option list and I need to use a React element for the image. And lastly, I don't want a library dependency to solve this (e.g. FontAwesome or Material UI).
Is there any way to accomplish the above?
