Back

Radio

1 
2<div class="like-unlike-radio">
3 <div>
4 <input
5 checked=""
6 id="like"
7 name="feedback"
8 value="like"
9 class="custom-radio-fb"
10 type="radio"
11 />
12 <label for="like" class="feedback-label">
13 <svg
14 class="icon"
15 width="27"
16 height="27"
17 viewBox="0 0 27 27"
18 fill="currentColor"
19 xmlns="http://www.w3.org/2000/svg"
20 >
21 <path
22 fill-rule="evenodd"
23 clip-rule="evenodd"
24 d="M0.7229 26.5H5.92292V10.9008H0.7229V26.5ZM26.6299 15.2618L24.372 23.7566C23.9989 25.3696 22.5621 26.5 20.9072 26.5H8.52293V10.9278L10.7573 2.87293C10.9669 1.50799 12.1418 0.5 13.524 0.5C15.0699 0.5 16.323 1.7527 16.323 3.29837V10.8998H23.1651C25.4519 10.9009 27.1453 13.0335 26.6299 15.2618Z"
25 fill="currentColor"
26 ></path>
27 </svg>
28 Like
29 </label>
30 </div>
31 <div>
32 <input
33 name="feedback"
34 value="unlike"
35 id="unlike"
36 class="custom-radio-fb"
37 type="radio"
38 />
39 <label for="unlike" class="feedback-label">
40 <svg
41 class="icon"
42 width="27"
43 height="27"
44 viewBox="0 0 27 27"
45 fill="currentColor"
46 xmlns="http://www.w3.org/2000/svg"
47 >
48 <path
49 fill-rule="evenodd"
50 clip-rule="evenodd"
51 d="M26.7229 0.5L21.5229 0.5L21.5229 16.0992L26.7229 16.0992L26.7229 0.5ZM0.815853 11.7382L3.07376 3.24339C3.44687 1.63037 4.88372 0.500027 6.53861 0.500027L18.9229 0.500028L18.9229 16.0722L16.6885 24.1271C16.4789 25.492 15.304 26.5 13.9218 26.5C12.3759 26.5 11.1228 25.2473 11.1228 23.7016L11.1228 16.1002L4.28068 16.1002C1.99391 16.0991 0.300502 13.9664 0.815853 11.7382Z"
52 fill="currentColor"
53 ></path>
54 </svg>
55 Unlike
56 </label>
57 </div>
58</div>
1 
2.like-unlike-radio {
3 --inactive-color: #515254;
4 --active-color: #1877f2;
5 --hover: #515254;
6 display: flex;
7 align-items: center;
8 column-gap: 24px;
9 flex-shrink: 0;
10}
11.like-unlike-radio .custom-radio-fb {
12 display: none;
13}
14.like-unlike-radio .feedback-label {
15 display: flex;
16 flex-direction: column;
17 align-items: center;
18 row-gap: 10px;
19 font-size: 14px;
20 font-weight: 600;
21 color: var(--inactive-color);
22 margin: 0;
23 cursor: pointer;
24 transition: 0.2s ease-in-out;
25 -webkit-transition: 0.2s ease-in-out;
26 -moz-transition: 0.2s ease-in-out;
27 -ms-transition: 0.2s ease-in-out;
28 -o-transition: 0.2s ease-in-out;
29}
30.like-unlike-radio .feedback-label:hover {
31 color: var(--hover);
32}
33.icon {
34 transition: 0.2s ease-in-out;
35 -webkit-transition: 0.2s ease-in-out;
36 -moz-transition: 0.2s ease-in-out;
37 -ms-transition: 0.2s ease-in-out;
38 -o-transition: 0.2s ease-in-out;
39}
40.like-unlike-radio .feedback-label:hover .icon {
41 transform: scale(1.3);
42}
43.like-unlike-radio .custom-radio-fb:checked ~ .feedback-label {
44 color: var(--active-color);
45}
46.like-unlike-radio .custom-radio-fb:checked ~ .feedback-label svg {
47 animation: keyframes-fill 0.2s ease-in-out;
48}
49/* ------ Animation ------ */
50@keyframes keyframes-fill {
51 0% {
52 transform: scale(0);
53 opacity: 0;
54 }
55 50% {
56 transform: scale(1.2) rotate(-10deg);
57 }
58}

MIT License

Copyright © 2026 Zain-Muhammad (Zain Muhammad)


Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:


The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.


THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.