I want to use images as radio buttons but couldn't find any source. Any help will be appreciated.
Asked
Active
Viewed 5,465 times
2
-
Is there a particular UI library you are using? – Matthew Kwong May 24 '21 at 09:03
-
i'm using material-ui – touchngo May 24 '21 at 09:09
3 Answers
2
You need to first hide your [type=radio] and then wrap your image and the input tag inside the label.

Md. Rakibul Islam
- 2,140
- 1
- 7
- 14

Neel Dsouza
- 1,342
- 4
- 15
- 33
2
Since the OP mentioned he is using Material-UI (you should add that tag next time BTW), take a look at the Radio documentation
There are icon
and checkedIcon
props, to which you can pass the corresponding images to.

Matthew Kwong
- 2,548
- 2
- 11
- 22
0
It's easy, simply replace the text in the label with the image you want to add. for example:
<FormControlLabel
value="paypal"
control={<Radio />}
label={<img src="https://assets.stickpng.com/images/580b57fcd9996e24bc43c530.png" alt="paypal" style={{width: "80px"}} />}
/>
Here I'm using radio buttons of MUI

Someone
- 1