2

I want to use images as radio buttons but couldn't find any source. Any help will be appreciated.

sample of radio button with images

touchngo
  • 35
  • 1
  • 6

3 Answers3

2

You need to first hide your [type=radio] and then wrap your image and the input tag inside the label.

This Stack Overflow link can be helpful

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