So this is the result I want to achieve (btw I am using tailwind):
But I don't know how to make the radio button change to img when it's checked. Right now, the buttons look like this:
This is the react code:
<div className="mt-6 flex w-full select-none flex-col items-start gap-y-4">
{checkboxItem.map((item, index) => (
<div
className="flex w-full items-center justify-between"
key={index}
>
<label
htmlFor={item.heading}
className="cursor-pointer font-medium"
>
{item.heading}
</label>
<input
id={item.heading}
value={item.heading}
onChange={() => setDevice(index)}
name="device"
type="radio"
className="h-[1.1rem] w-[1.1rem] cursor-pointer"
/>
</div>
))}
</div>
I haven't tried anything yet.
HI mate you can do like this.
I hope be useful and good luck.