Animated Button by codepeek
Zoom
Saved
1 line⌘Z Undo
1<!--2 Author: @codepeek3 License: MIT4 Tags: #animated #button #dark #hover #menu5-->6<div class="sdb">7 <button class="sdb__main" type="button">8 <svg class="sdb__icon" viewBox="0 0 24 24" aria-hidden="true">9 <path d="M12 19V5m0 0-6 6m6-6 6 6"/>10 </svg>11 Deploy to prod12 </button>13 <details class="sdb__more">14 <summary class="sdb__toggle" aria-label="More deploy targets">15 <svg class="sdb__chev" viewBox="0 0 24 24" aria-hidden="true">16 <path d="m6 9 6 6 6-6"/>17 </svg>18 </summary>19 <div class="sdb__menu">20 <button class="sdb__item" type="button">21 Deploy to staging22 <kbd class="sdb__kbd">⌥S</kbd>23 </button>24 <button class="sdb__item" type="button">25 Open preview26 <kbd class="sdb__kbd">⌥P</kbd>27 </button>28 <button class="sdb__item sdb__item--warn" type="button">Roll back to v2.4.1</button>29 </div>30 </details>31</div>
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
<!--
Author: @codepeek
License: MIT
Tags: #animated #button #dark #hover #menu
-->
<div class="sdb">
<button class="sdb__main" type="button">
<svg class="sdb__icon" viewBox="0 0 24 24" aria-hidden="true">
<path d="M12 19V5m0 0-6 6m6-6 6 6"/>
</svg>
Deploy to prod
</button>
<details class="sdb__more">
<summary class="sdb__toggle" aria-label="More deploy targets">
<svg class="sdb__chev" viewBox="0 0 24 24" aria-hidden="true">
<path d="m6 9 6 6 6-6"/>
</svg>
</summary>
<div class="sdb__menu">
<button class="sdb__item" type="button">
Deploy to staging
<kbd class="sdb__kbd">⌥S</kbd>
</button>
<button class="sdb__item" type="button">
Open preview
<kbd class="sdb__kbd">⌥P</kbd>
</button>
<button class="sdb__item sdb__item--warn" type="button">Roll back to v2.4.1</button>
</div>
</details>
</div>1/* * Author: @codepeek * License: MIT * Tags: #animated #button #dark #hover #menu */2.sdb {3 position: relative;4 display: inline-flex;5 width: 236px;6 height: 46px;7 font-family: "Helvetica Neue", Arial, sans-serif;8 font-size: 14px;9 color: #f3efe8;10}11.sdb__main {12 flex: 1;13 display: inline-flex;14 align-items: center;15 gap: 8px;16 padding: 0 16px;17 border: 0;18 border-radius: 6px 0 0 6px;19 color: #1b1b1b;20 font: inherit;21 font-weight: 700;22 background-color: #ff5f1f;23 background-image: repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.1) 0 8px, transparent 8px 16px);24 background-size: 200% 100%;25 background-position: 0 0;26 box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22);27 cursor: pointer;28 transition: background-position 700ms linear, transform 120ms ease, box-shadow 120ms ease;29}30.sdb__main:hover {31 background-position: 100% 0;32}33.sdb__main:active {34 transform: translateY(1px);35 box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.22);36}37.sdb__main:focus-visible, .sdb__toggle:focus-visible {38 outline: 2px solid #f3efe8;39 outline-offset: 3px;40}41.sdb__icon, .sdb__chev {42 width: 17px;43 height: 17px;44 fill: none;45 stroke: currentColor;46 stroke-width: 2.4;47 stroke-linecap: round;48 stroke-linejoin: round;49 transition: transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1);50}51.sdb__main:hover .sdb__icon {52 transform: translateY(-2px);53}54.sdb__more {55 position: relative;56}57.sdb__toggle {58 display: grid;59 place-items: center;60 width: 44px;61 height: 46px;62 list-style: none;63 border-left: 1px solid rgba(0, 0, 0, 0.35);64 border-radius: 0 6px 6px 0;65 background: #ff5f1f;66 color: #1b1b1b;67 box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22);68 cursor: pointer;69 transition: background 160ms ease, color 160ms ease;70}71.sdb__toggle::-webkit-details-marker {72 display: none;73}74.sdb__toggle:hover {75 background: color-mix(in srgb, #ff5f1f, #fff 16%);76}77.sdb__more[open] .sdb__toggle {78 background: #2a2b2d;79 color: #ff5f1f;80 box-shadow: none;81}82.sdb__more[open] .sdb__chev {83 transform: rotate(180deg);84}85.sdb__menu {86 position: absolute;87 top: calc(100% + 8px);88 right: 0;89 z-index: 2;90 display: grid;91 width: 236px;92 padding: 6px;93 box-sizing: border-box;94 border: 1px solid #3a3b3e;95 border-radius: 6px;96 background: #2a2b2d;97 box-shadow: 0 18px 30px -12px rgba(0, 0, 0, 0.7);98 animation: sdb-drop 280ms cubic-bezier(0.2, 1.2, 0.4, 1);99}100@keyframes sdb-drop {101 from {102 clip-path: inset(0 0 100% 0 round 6px);103 transform: translateY(-6px);104 }105 to {106 clip-path: inset(0 0 0 0 round 6px);107 transform: none;108 }109}110.sdb__item {111 display: flex;112 align-items: center;113 justify-content: space-between;114 padding: 9px 10px;115 border: 0;116 border-radius: 4px;117 background: transparent;118 color: #f3efe8;119 font: inherit;120 font-size: 13px;121 text-align: left;122 cursor: pointer;123}124.sdb__item:hover, .sdb__item:focus-visible {125 background: #37383b;126 outline: none;127}128.sdb__item--warn {129 color: #ff8a5c;130}131.sdb__kbd {132 font-family: ui-monospace, Menlo, monospace;133 font-size: 11px;134 color: #9a968f;135}136@media (prefers-reduced-motion: reduce) {137 .sdb__menu {138 animation: none;139 }140}
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/* * Author: @codepeek * License: MIT * Tags: #animated #button #dark #hover #menu */
.sdb {
position: relative;
display: inline-flex;
width: 236px;
height: 46px;
font-family: "Helvetica Neue", Arial, sans-serif;
font-size: 14px;
color: #f3efe8;
}
.sdb__main {
flex: 1;
display: inline-flex;
align-items: center;
gap: 8px;
padding: 0 16px;
border: 0;
border-radius: 6px 0 0 6px;
color: #1b1b1b;
font: inherit;
font-weight: 700;
background-color: #ff5f1f;
background-image: repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.1) 0 8px, transparent 8px 16px);
background-size: 200% 100%;
background-position: 0 0;
box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22);
cursor: pointer;
transition: background-position 700ms linear, transform 120ms ease, box-shadow 120ms ease;
}
.sdb__main:hover {
background-position: 100% 0;
}
.sdb__main:active {
transform: translateY(1px);
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.22);
}
.sdb__main:focus-visible, .sdb__toggle:focus-visible {
outline: 2px solid #f3efe8;
outline-offset: 3px;
}
.sdb__icon, .sdb__chev {
width: 17px;
height: 17px;
fill: none;
stroke: currentColor;
stroke-width: 2.4;
stroke-linecap: round;
stroke-linejoin: round;
transition: transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sdb__main:hover .sdb__icon {
transform: translateY(-2px);
}
.sdb__more {
position: relative;
}
.sdb__toggle {
display: grid;
place-items: center;
width: 44px;
height: 46px;
list-style: none;
border-left: 1px solid rgba(0, 0, 0, 0.35);
border-radius: 0 6px 6px 0;
background: #ff5f1f;
color: #1b1b1b;
box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22);
cursor: pointer;
transition: background 160ms ease, color 160ms ease;
}
.sdb__toggle::-webkit-details-marker {
display: none;
}
.sdb__toggle:hover {
background: color-mix(in srgb, #ff5f1f, #fff 16%);
}
.sdb__more[open] .sdb__toggle {
background: #2a2b2d;
color: #ff5f1f;
box-shadow: none;
}
.sdb__more[open] .sdb__chev {
transform: rotate(180deg);
}
.sdb__menu {
position: absolute;
top: calc(100% + 8px);
right: 0;
z-index: 2;
display: grid;
width: 236px;
padding: 6px;
box-sizing: border-box;
border: 1px solid #3a3b3e;
border-radius: 6px;
background: #2a2b2d;
box-shadow: 0 18px 30px -12px rgba(0, 0, 0, 0.7);
animation: sdb-drop 280ms cubic-bezier(0.2, 1.2, 0.4, 1);
}
@keyframes sdb-drop {
from {
clip-path: inset(0 0 100% 0 round 6px);
transform: translateY(-6px);
}
to {
clip-path: inset(0 0 0 0 round 6px);
transform: none;
}
}
.sdb__item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 9px 10px;
border: 0;
border-radius: 4px;
background: transparent;
color: #f3efe8;
font: inherit;
font-size: 13px;
text-align: left;
cursor: pointer;
}
.sdb__item:hover, .sdb__item:focus-visible {
background: #37383b;
outline: none;
}
.sdb__item--warn {
color: #ff8a5c;
}
.sdb__kbd {
font-family: ui-monospace, Menlo, monospace;
font-size: 11px;
color: #9a968f;
}
@media (prefers-reduced-motion: reduce) {
.sdb__menu {
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 safety-orange split button with hazard stripes that slide on hover. The chevron opens a graphite menu of other deploy targets that unrolls with clip-path.
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.