Animated Button by codepeek
Zoom
Saved
1 line⌘Z Undo
1<!--2 Author: @codepeek3 License: MIT4 Tags: #animated #button #checkbox #dark #mechanical5-->6<label class="mrb">7 <input class="mrb__input" type="checkbox" aria-label="Record voice memo"/>8 <span class="mrb__pulse" aria-hidden="true">9 </span>10 <span class="mrb__body" aria-hidden="true">11 <span class="mrb__glyph">12 </span>13 </span>14 <span class="mrb__led" aria-hidden="true">15 </span>16</label>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!--
Author: @codepeek
License: MIT
Tags: #animated #button #checkbox #dark #mechanical
-->
<label class="mrb">
<input class="mrb__input" type="checkbox" aria-label="Record voice memo"/>
<span class="mrb__pulse" aria-hidden="true">
</span>
<span class="mrb__body" aria-hidden="true">
<span class="mrb__glyph">
</span>
</span>
<span class="mrb__led" aria-hidden="true">
</span>
</label>1/* * Author: @codepeek * License: MIT * Tags: #animated #button #checkbox #dark #mechanical */2.mrb {3 position: relative;4 display: grid;5 place-items: center;6 width: 96px;7 height: 96px;8 border-radius: 50%;9 cursor: pointer;10 -webkit-tap-highlight-color: transparent;11}12.mrb:has(.mrb__input:focus-visible) {13 outline: 2px solid #e2412b;14 outline-offset: 4px;15}16.mrb__input {17 position: absolute;18 width: 1px;19 height: 1px;20 margin: -1px;21 padding: 0;22 border: 0;23 overflow: hidden;24 clip: rect(0 0 0 0);25 white-space: nowrap;26}27.mrb__body {28 grid-area: 1 / 1;29 display: grid;30 place-items: center;31 width: 84px;32 height: 84px;33 border-radius: 50%;34 background: repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 3px), radial-gradient(circle at 50% 32%, #2e2e2e, #121212 70%);35 box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), inset 0 -4px 8px rgba(0, 0, 0, 0.6), 0 0 0 4px #0b0b0b, 0 0 0 5px #343434, 0 14px 22px -8px rgba(0, 0, 0, 0.9);36 transition: transform 160ms cubic-bezier(0.34, 1.56, 0.64, 1);37}38.mrb:active .mrb__body {39 transform: scale(0.94);40}41.mrb__glyph {42 width: 30px;43 height: 30px;44 border-radius: 50%;45 background: #e2412b;46 box-shadow: 0 0 0 3px rgba(226, 65, 43, 0.18);47 transition: width 320ms cubic-bezier(0.34, 1.56, 0.64, 1), height 320ms cubic-bezier(0.34, 1.56, 0.64, 1), border-radius 320ms ease, box-shadow 200ms ease;48}49.mrb:hover .mrb__glyph {50 box-shadow: 0 0 0 7px rgba(226, 65, 43, 0.16);51}52.mrb__input:checked ~ .mrb__body .mrb__glyph {53 width: 24px;54 height: 24px;55 border-radius: 5px;56}57.mrb__pulse {58 grid-area: 1 / 1;59 width: 84px;60 height: 84px;61 box-sizing: border-box;62 border: 2px solid #e2412b;63 border-radius: 50%;64 opacity: 0;65}66.mrb__input:checked ~ .mrb__pulse {67 animation: mrb-ring 1.6s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;68}69.mrb__led {70 position: absolute;71 top: 4px;72 right: 8px;73 width: 7px;74 height: 7px;75 border-radius: 50%;76 background: #3a1410;77 transition: background 200ms ease, box-shadow 200ms ease;78}79.mrb__input:checked ~ .mrb__led {80 background: #ff3b22;81 box-shadow: 0 0 8px 2px rgba(255, 59, 34, 0.65);82 animation: mrb-blink 1s steps(1) infinite;83}84@keyframes mrb-ring {85 from {86 transform: scale(1);87 opacity: 0.7;88 }89 to {90 transform: scale(1.38);91 opacity: 0;92 }93}94@keyframes mrb-blink {95 50% {96 opacity: 0.25;97 }98}99@media (prefers-reduced-motion: reduce) {100 .mrb__input:checked ~ .mrb__pulse, .mrb__input:checked ~ .mrb__led {101 animation: none;102 }103}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* * Author: @codepeek * License: MIT * Tags: #animated #button #checkbox #dark #mechanical */
.mrb {
position: relative;
display: grid;
place-items: center;
width: 96px;
height: 96px;
border-radius: 50%;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
.mrb:has(.mrb__input:focus-visible) {
outline: 2px solid #e2412b;
outline-offset: 4px;
}
.mrb__input {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
border: 0;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
}
.mrb__body {
grid-area: 1 / 1;
display: grid;
place-items: center;
width: 84px;
height: 84px;
border-radius: 50%;
background: repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 3px), radial-gradient(circle at 50% 32%, #2e2e2e, #121212 70%);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), inset 0 -4px 8px rgba(0, 0, 0, 0.6), 0 0 0 4px #0b0b0b, 0 0 0 5px #343434, 0 14px 22px -8px rgba(0, 0, 0, 0.9);
transition: transform 160ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mrb:active .mrb__body {
transform: scale(0.94);
}
.mrb__glyph {
width: 30px;
height: 30px;
border-radius: 50%;
background: #e2412b;
box-shadow: 0 0 0 3px rgba(226, 65, 43, 0.18);
transition: width 320ms cubic-bezier(0.34, 1.56, 0.64, 1), height 320ms cubic-bezier(0.34, 1.56, 0.64, 1), border-radius 320ms ease, box-shadow 200ms ease;
}
.mrb:hover .mrb__glyph {
box-shadow: 0 0 0 7px rgba(226, 65, 43, 0.16);
}
.mrb__input:checked ~ .mrb__body .mrb__glyph {
width: 24px;
height: 24px;
border-radius: 5px;
}
.mrb__pulse {
grid-area: 1 / 1;
width: 84px;
height: 84px;
box-sizing: border-box;
border: 2px solid #e2412b;
border-radius: 50%;
opacity: 0;
}
.mrb__input:checked ~ .mrb__pulse {
animation: mrb-ring 1.6s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}
.mrb__led {
position: absolute;
top: 4px;
right: 8px;
width: 7px;
height: 7px;
border-radius: 50%;
background: #3a1410;
transition: background 200ms ease, box-shadow 200ms ease;
}
.mrb__input:checked ~ .mrb__led {
background: #ff3b22;
box-shadow: 0 0 8px 2px rgba(255, 59, 34, 0.65);
animation: mrb-blink 1s steps(1) infinite;
}
@keyframes mrb-ring {
from {
transform: scale(1);
opacity: 0.7;
}
to {
transform: scale(1.38);
opacity: 0;
}
}
@keyframes mrb-blink {
50% {
opacity: 0.25;
}
}
@media (prefers-reduced-motion: reduce) {
.mrb__input:checked ~ .mrb__pulse, .mrb__input:checked ~ .mrb__led {
animation: none;
}
}Changes made here are only a live preview and will not be saved.
Save to GitHub
GitHub opens a new file in your repository with this element filled in. Review it there and press Commit changes. Nothing is sent from codepeek and no GitHub access is needed.
◉ 1 views
Build it with AIA ready prompt with the code, the credit and how to adapt it to your project.
A matte black, lathe-turned record button with one LED. Checking it morphs the red dot into a stop square, pulses a ring outward and blinks the LED.
Choose where to donate
Select a platform to continue.
Community
Comments 0
Code copied
SUPPORT THE CREATOR
Would you like to donate to the creator to help them keep creating content?
You need to sign in before you can write a comment.