I have a label wrapping an input radio button, what I want is that when the user clicks on the input radio, the label wrapping the radio changes its background color. How can I achieve that?
.radio-label {
width: 100%;
height: 2.5rem;
display: flex;
flex-direction: row-reverse;
justify-content: center;
align-items: center;
cursor: pointer;
padding: 0.5rem;
font-size: 0.9rem;
background-color: #f5f5f5;
border-radius: 0.5rem;
}
.radio-label:hover {
background-color: #e5e5e5;
color: var(--black);
}
.radio-label input {
height: 1rem;
width: 1rem;
margin-right: 0.6rem;
cursor: pointer;
border: none;
}
.radio-label input:checked .radio-label {
background-color: var(--orange);
color: var(--black);
}
<label className="radio-label">
<span>Test</span>
<input type="radio" name="test" id="test1" />
</label>