JSFiddle - React, Tailwind, and code Playground
by Mr_Vasu
HTML
<input id="star_1" value="1" type="radio" checked name="star"></input>
<label for="star_1">★</label>
<input id="star_2" value="2" type="radio" name="star"></input>
<label for="star_2">★</label>
<input id="star_3" value="3" type="radio" name="star"></input>
<label for="star_3">★</label>
<input id="star_4" value="4" type="radio" name="star"></input>
<label for="star_4">★</label>
<input id="star_5" value="5" type="radio" name="star"></input>
<label for="star_5">★</label>
CSS
input[type="radio"] {
display: none;
pointer-events: none;
position: absolute;
}
label {
position: relative;
margin-right: 30px;
display: inline-block;
margin-top: 30px;
transform: rotate(0deg);
transition: transform 1s, background 1s;
color: gold;
font-size: 40px;
width: 50px;
height: 50px;
text-align: center;
line-height: 50px;
border-radius: 50%;
background-color: #ACACAC;
border: 4px solid silver;
cursor: pointer;
}
:checked + label {
color: gold;
transform: rotate(-144deg);
background-color: #ACACAC;
}
:checked + label ~ label{
background-color: beige;
transform: rotate(-144deg);
color: tomato;
}