Live preview
Preview settings
Tailwind preview ready. Custom CSS is applied after utilities.
⌘ / Ctrl + S saves locally
S u b m i t t e d S e n d M e s s a g e · Shubh0408
HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.
By Shubh0408
Button submission checks
Checks will appear after the preview updates.
Buttons only: no full pages, forms, cards or navigation. Put scripts in the JavaScript tab. Tailwind uses utilities from HTML and JavaScript; use complete class names. Custom CSS supports plain CSS, without @apply, imports or plugins.
Accessibility quick check
Waiting for the rendered preview…
Try Tab, Enter and Space in the preview. Check the focus ring, hover and disabled states, then enable Reduce motion. These checks are guidance, not an accessibility certification.
Explore freely here. Remix to publish your version with credit to the creator.
About S u b m i t t e d S e n d M e s s a g e · Shubh0408
S u b m i t t e d S e n d M e s s a g e · Shubh0408 is an animated Tailwind CSS v4 button by Shubh0408. Preview the interaction, customize its HTML, styles and JavaScript, or download the files with creator credit.
- Effects and categories
- Hover effects, Toggle, Icon
- Using this example
- Copy the HTML or download index.html, style.css and app.js. Test keyboard focus, motion and contrast in your own project.
Usage, Tailwind and licensing questions
Read the source files
HTML
<button class="cursor-pointer">
<label class="flex justify-center items-center">
<div class="w-fit p-1 m-2 rounded-md border shadow-2xl">
<div class="relative rounded-full shadow-[0px_3px_10px_0px_rgba(156,156,156,0.75)_inset] hover:shadow-[0px_-3px_10px_0px_rgba(156,156,156,0.75)_inset] px-4 py-2 duration-700 flex justify-center items-center overflow-hidden">
<input type="checkbox" class="peer hidden">
<span class="absolute -top-5 left-[1.2rem] peer-checked:duration-700 peer-checked:top-2 peer-checked:delay-[100ms]">S</span>
<span class="absolute -top-5 left-[1.7rem] peer-checked:duration-700 peer-checked:top-2 peer-checked:delay-[200ms]">u</span>
<span class="absolute -top-5 left-[2.25rem] peer-checked:duration-700 peer-checked:top-2 peer-checked:delay-[250ms]">b</span>
<span class="absolute -top-5 left-[2.8rem] peer-checked:duration-700 peer-checked:top-2 peer-checked:delay-[350ms]">m</span>
<span class="absolute -top-5 left-[3.65rem] peer-checked:duration-700 peer-checked:top-2 peer-checked:delay-[300ms]">i</span>
<span class="absolute -top-5 left-[4rem] peer-checked:duration-700 peer-checked:top-2 peer-checked:delay-[350ms]">t</span>
<span class="absolute -top-5 left-[4.4rem] peer-checked:duration-700 peer-checked:top-2 peer-checked:delay-[400ms]">t</span>
<span class="absolute -top-5 left-[4.9rem] peer-checked:duration-700 peer-checked:top-2 peer-checked:delay-[450ms]">e</span>
<span class="absolute -top-5 left-[5.4rem] peer-checked:duration-700 peer-checked:top-2 peer-checked:delay-[500ms]">d</span>
<svg width="19" height="19" viewBox="0 0 0.6 0.6" fill="none" class="peer-checked:translate-x-24 peer-checked:rotate-45 duration-1000 fill-black peer-checked:fill-green-700 mr-1">
<path d="M.356.541C.327.541.285.52.252.421L.234.367.18.349C.081.316.06.274.06.245S.081.174.18.141L.392.07Q.473.043.517.084C.561.125.55.155.532.209L.461.421c-.033.1-.075.12-.104.12M.191.176C.122.199.097.227.097.245s.025.046.094.069l.063.021q.009.003.012.012L.287.41C.31.479.338.504.356.504S.402.479.425.41L.496.198Q.516.138.49.112C.464.086.442.094.404.106z"></path>
<path d="M.253.36A.02.02 0 0 1 .24.354a.02.02 0 0 1 0-.027l.09-.09C.337.23.349.23.357.237s.007.019 0 .027l-.09.09A.02.02 0 0 1 .254.36"></path>
</svg>
<span class="delay-1000 peer-checked:opacity-0 peer-checked:delay-[0ms]">S</span>
<span class="delay-1000 peer-checked:opacity-0 peer-checked:delay-[50ms]">e</span>
<span class="delay-1000 peer-checked:opacity-0 peer-checked:delay-[100ms]">n</span>
<span class="delay-1000 peer-checked:opacity-0 peer-checked:delay-[150ms]">d</span>
<span class="delay-1000 peer-checked:opacity-0 peer-checked:delay-[250ms]"> </span>
<span class="delay-1000 peer-checked:opacity-0 peer-checked:delay-[300ms]">M</span>
<span class="delay-1000 peer-checked:opacity-0 peer-checked:delay-[350ms]">e</span>
<span class="delay-1000 peer-checked:opacity-0 peer-checked:delay-[400ms]">s</span>
<span class="delay-1000 peer-checked:opacity-0 peer-checked:delay-[450ms]">s</span>
<span class="delay-1000 peer-checked:opacity-0 peer-checked:delay-[500ms]">a</span>
<span class="delay-1000 peer-checked:opacity-0 peer-checked:delay-[550ms]">g</span>
<span class="delay-1000 peer-checked:opacity-0 peer-checked:delay-[600ms]">e</span>
</div>
</div>
</label>
</button>CSS
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
@layer properties;
@layer theme, base, components, utilities;
@layer theme {
:root, :host {
--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
"Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
"Segoe UI Symbol", "Noto Color Emoji";
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
"Courier New", monospace;
--color-green-700: oklch(52.7% 0.154 150.069);
--color-black: #000;
--spacing: 0.25rem;
--radius-md: 0.375rem;
--default-font-family: var(--font-sans);
--default-mono-font-family: var(--font-mono);
}
}
@layer base {
*, ::after, ::before, ::backdrop, ::file-selector-button {
box-sizing: border-box;
margin: 0;
padding: 0;
border: 0 solid;
}
html, :host {
line-height: 1.5;
-webkit-text-size-adjust: 100%;
tab-size: 4;
font-family: var(--default-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");
font-feature-settings: var(--default-font-feature-settings, normal);
font-variation-settings: var(--default-font-variation-settings, normal);
-webkit-tap-highlight-color: transparent;
}
hr {
height: 0;
color: inherit;
border-top-width: 1px;
}
abbr:where([title]) {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
}
h1, h2, h3, h4, h5, h6 {
font-size: inherit;
font-weight: inherit;
}
a {
color: inherit;
-webkit-text-decoration: inherit;
text-decoration: inherit;
}
b, strong {
font-weight: bolder;
}
code, kbd, samp, pre {
font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
font-feature-settings: var(--default-mono-font-feature-settings, normal);
font-variation-settings: var(--default-mono-font-variation-settings, normal);
font-size: 1em;
}
small {
font-size: 80%;
}
sub, sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
table {
text-indent: 0;
border-color: inherit;
border-collapse: collapse;
}
:-moz-focusring:where(:not(iframe)) {
outline: auto;
}
progress {
vertical-align: baseline;
}
summary {
display: list-item;
}
ol, ul, menu {
list-style: none;
}
img, svg, video, canvas, audio, iframe, embed, object {
display: block;
vertical-align: middle;
}
img, video {
max-width: 100%;
height: auto;
}
button, input, select, optgroup, textarea, ::file-selector-button {
font: inherit;
font-feature-settings: inherit;
font-variation-settings: inherit;
letter-spacing: inherit;
color: inherit;
border-radius: 0;
background-color: transparent;
opacity: 1;
}
:where(select:is([multiple], [size])) optgroup {
font-weight: bolder;
}
:where(select:is([multiple], [size])) optgroup option {
padding-inline-start: 20px;
}
::file-selector-button {
margin-inline-end: 4px;
}
::placeholder {
opacity: 1;
}
@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
::placeholder {
color: currentcolor;
@supports (color: color-mix(in lab, red, red)) {
color: color-mix(in oklab, currentcolor 50%, transparent);
}
}
}
textarea {
resize: vertical;
}
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-date-and-time-value {
min-height: 1lh;
text-align: inherit;
}
::-webkit-datetime-edit {
display: inline-flex;
}
::-webkit-datetime-edit-fields-wrapper {
padding: 0;
}
::-webkit-datetime-edit, ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field, ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field, ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field {
padding-block: 0;
}
::-webkit-calendar-picker-indicator {
line-height: 1;
}
:-moz-ui-invalid {
box-shadow: none;
}
button, input:where([type="button"], [type="reset"], [type="submit"]), ::file-selector-button {
appearance: button;
}
::-webkit-inner-spin-button, ::-webkit-outer-spin-button {
height: auto;
}
[hidden]:where(:not([hidden="until-found"])) {
display: none !important;
}
}
@layer utilities {
.absolute {
position: absolute;
}
.relative {
position: relative;
}
.-top-5 {
top: calc(var(--spacing) * -5);
}
.left-\[1\.2rem\] {
left: 1.2rem;
}
.left-\[1\.7rem\] {
left: 1.7rem;
}
.left-\[2\.8rem\] {
left: 2.8rem;
}
.left-\[2\.25rem\] {
left: 2.25rem;
}
.left-\[3\.65rem\] {
left: 3.65rem;
}
.left-\[4\.4rem\] {
left: 4.4rem;
}
.left-\[4\.9rem\] {
left: 4.9rem;
}
.left-\[4rem\] {
left: 4rem;
}
.left-\[5\.4rem\] {
left: 5.4rem;
}
.m-2 {
margin: calc(var(--spacing) * 2);
}
.mr-1 {
margin-right: var(--spacing);
}
.flex {
display: flex;
}
.hidden {
display: none;
}
.w-fit {
width: fit-content;
}
.cursor-pointer {
cursor: pointer;
}
.items-center {
align-items: center;
}
.justify-center {
justify-content: center;
}
.overflow-hidden {
overflow: hidden;
}
.rounded-full {
border-radius: calc(infinity * 1px);
}
.rounded-md {
border-radius: var(--radius-md);
}
.border {
border-style: var(--tw-border-style);
border-width: 1px;
}
.fill-black {
fill: var(--color-black);
}
.p-1 {
padding: var(--spacing);
}
.px-4 {
padding-inline: calc(var(--spacing) * 4);
}
.py-2 {
padding-block: calc(var(--spacing) * 2);
}
.shadow-2xl {
--tw-shadow: 0 25px 50px -12px var(--tw-shadow-color, rgb(0 0 0 / 0.25));
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
}
.shadow-\[0px_3px_10px_0px_rgba\(156\,156\,156\,0\.75\)_inset\] {
--tw-shadow: 0px 3px 10px 0px var(--tw-shadow-color, rgba(156,156,156,0.75)) inset;
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
}
.delay-1000 {
transition-delay: 1000ms;
}
.duration-700 {
--tw-duration: 700ms;
transition-duration: 700ms;
}
.duration-1000 {
--tw-duration: 1000ms;
transition-duration: 1000ms;
}
.peer-checked\:top-2:is(:where(.peer):checked ~ *) {
top: calc(var(--spacing) * 2);
}
.peer-checked\:translate-x-24:is(:where(.peer):checked ~ *) {
--tw-translate-x: calc(var(--spacing) * 24);
translate: var(--tw-translate-x) var(--tw-translate-y);
}
.peer-checked\:rotate-45:is(:where(.peer):checked ~ *) {
rotate: 45deg;
}
.peer-checked\:fill-green-700:is(:where(.peer):checked ~ *) {
fill: var(--color-green-700);
}
.peer-checked\:opacity-0:is(:where(.peer):checked ~ *) {
opacity: 0%;
}
.peer-checked\:delay-\[0ms\]:is(:where(.peer):checked ~ *) {
transition-delay: 0ms;
}
.peer-checked\:delay-\[50ms\]:is(:where(.peer):checked ~ *) {
transition-delay: 50ms;
}
.peer-checked\:delay-\[100ms\]:is(:where(.peer):checked ~ *) {
transition-delay: 100ms;
}
.peer-checked\:delay-\[150ms\]:is(:where(.peer):checked ~ *) {
transition-delay: 150ms;
}
.peer-checked\:delay-\[200ms\]:is(:where(.peer):checked ~ *) {
transition-delay: 200ms;
}
.peer-checked\:delay-\[250ms\]:is(:where(.peer):checked ~ *) {
transition-delay: 250ms;
}
.peer-checked\:delay-\[300ms\]:is(:where(.peer):checked ~ *) {
transition-delay: 300ms;
}
.peer-checked\:delay-\[350ms\]:is(:where(.peer):checked ~ *) {
transition-delay: 350ms;
}
.peer-checked\:delay-\[400ms\]:is(:where(.peer):checked ~ *) {
transition-delay: 400ms;
}
.peer-checked\:delay-\[450ms\]:is(:where(.peer):checked ~ *) {
transition-delay: 450ms;
}
.peer-checked\:delay-\[500ms\]:is(:where(.peer):checked ~ *) {
transition-delay: 500ms;
}
.peer-checked\:delay-\[550ms\]:is(:where(.peer):checked ~ *) {
transition-delay: 550ms;
}
.peer-checked\:delay-\[600ms\]:is(:where(.peer):checked ~ *) {
transition-delay: 600ms;
}
.peer-checked\:duration-700:is(:where(.peer):checked ~ *) {
--tw-duration: 700ms;
transition-duration: 700ms;
}
@media (hover: hover) {
.hover\:shadow-\[0px_-3px_10px_0px_rgba\(156\,156\,156\,0\.75\)_inset\]:hover {
--tw-shadow: 0px -3px 10px 0px var(--tw-shadow-color, rgba(156,156,156,0.75)) inset;
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
}
}
}
@property --tw-border-style {
syntax: "*";
inherits: false;
initial-value: solid;
}
@property --tw-shadow {
syntax: "*";
inherits: false;
initial-value: 0 0 #0000;
}
@property --tw-shadow-color {
syntax: "*";
inherits: false;
}
@property --tw-shadow-alpha {
syntax: "<percentage>";
inherits: false;
initial-value: 100%;
}
@property --tw-inset-shadow {
syntax: "*";
inherits: false;
initial-value: 0 0 #0000;
}
@property --tw-inset-shadow-color {
syntax: "*";
inherits: false;
}
@property --tw-inset-shadow-alpha {
syntax: "<percentage>";
inherits: false;
initial-value: 100%;
}
@property --tw-ring-color {
syntax: "*";
inherits: false;
}
@property --tw-ring-shadow {
syntax: "*";
inherits: false;
initial-value: 0 0 #0000;
}
@property --tw-inset-ring-color {
syntax: "*";
inherits: false;
}
@property --tw-inset-ring-shadow {
syntax: "*";
inherits: false;
initial-value: 0 0 #0000;
}
@property --tw-ring-inset {
syntax: "*";
inherits: false;
}
@property --tw-ring-offset-width {
syntax: "<length>";
inherits: false;
initial-value: 0px;
}
@property --tw-ring-offset-color {
syntax: "*";
inherits: false;
initial-value: #fff;
}
@property --tw-ring-offset-shadow {
syntax: "*";
inherits: false;
initial-value: 0 0 #0000;
}
@property --tw-duration {
syntax: "*";
inherits: false;
}
@property --tw-translate-x {
syntax: "*";
inherits: false;
initial-value: 0;
}
@property --tw-translate-y {
syntax: "*";
inherits: false;
initial-value: 0;
}
@property --tw-translate-z {
syntax: "*";
inherits: false;
initial-value: 0;
}
@layer properties {
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
*, ::before, ::after, ::backdrop {
--tw-border-style: solid;
--tw-shadow: 0 0 #0000;
--tw-shadow-color: initial;
--tw-shadow-alpha: 100%;
--tw-inset-shadow: 0 0 #0000;
--tw-inset-shadow-color: initial;
--tw-inset-shadow-alpha: 100%;
--tw-ring-color: initial;
--tw-ring-shadow: 0 0 #0000;
--tw-inset-ring-color: initial;
--tw-inset-ring-shadow: 0 0 #0000;
--tw-ring-inset: initial;
--tw-ring-offset-width: 0px;
--tw-ring-offset-color: #fff;
--tw-ring-offset-shadow: 0 0 #0000;
--tw-duration: initial;
--tw-translate-x: 0;
--tw-translate-y: 0;
--tw-translate-z: 0;
}
}
}