Live preview
Preview settings
Tailwind preview ready. Custom CSS is applied after utilities.
⌘ / Ctrl + S saves locally
OP EN · catraco
HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.
By catraco
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 OP EN · catraco
OP EN · catraco is an animated Tailwind CSS v4 button by catraco. Preview the interaction, customize its HTML, styles and JavaScript, or download the files with creator credit.
- Effects and categories
- Hover effects, Icon, Animated
- 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 relative p-3 border-2 border-white overflow-hidden bg-gradient-to-tr from-yellow-100 to-yellow-200 group duration-300 hover:-rotate-45 hover:opacity-75 hover:scale-125 active:scale-100 rounded-full drop-shadow-xl">
<svg class="animate-pulse group-hover:scale-100 group-hover:rotate-45 scale-75 duration-500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="50px" height="50px" viewBox="0 0 512 512" xml:space="preserve">
<path class="fill-slate-600" d="M356.766,8.17c-20.892,0-39.481,9.814-51.446,25.071L256,96.085l-21.787,64.596l122.553-21.787 c36.098,0,65.362-29.264,65.362-65.362S392.864,8.17,356.766,8.17z M356.766,106.213h-67.171l41.434-52.796 c6.266-7.988,15.644-12.566,25.737-12.566c18.02,0,32.681,14.661,32.681,32.681S374.786,106.213,356.766,106.213z"></path>
<path class="fill-slate-600" d="M206.68,33.241C194.715,17.984,176.126,8.17,155.234,8.17c-36.098,0-65.362,29.264-65.362,65.362 s29.264,65.362,65.362,65.362L256,160.681V96.085L206.68,33.241z M155.234,106.213c-18.02,0-32.681-14.661-32.681-32.681 s14.661-32.681,32.681-32.681c10.093,0,19.471,4.577,25.73,12.557l41.441,52.805H155.234z"></path>
<polygon class="fill-red-400" points="57.191,226.043 57.191,258.723 404.033,258.723 422.128,503.83 454.809,503.83 454.809,226.043 256,171.574"></polygon>
<polygon class="fill-red-300" points="57.191,258.723 57.191,503.83 223.319,503.83 256,471.149 288.681,503.83 422.128,503.83 422.128,258.723"></polygon>
<polygon class="fill-red-400" points="433.021,138.894 411.234,171.574 433.021,226.043 465.702,226.043 465.702,138.894"></polygon>
<rect x="46.298" y="138.894" class="fill-red-300" width="386.723" height="87.149"></rect>
<rect x="223.319" y="138.894" class="fill-slate-600" width="65.362" height="364.936"></rect>
<path class="fill-orange-200" d="M256,73.532c-18.05,0-32.681,14.631-32.681,32.681v32.681h65.362v-32.681 C288.681,88.163,274.05,73.532,256,73.532z"></path>
<path class="fill-none" d="M465.702,130.723h-62.79c16.688-13.491,27.385-34.111,27.385-57.191C430.298,32.986,397.312,0,356.766,0 c-22.725,0-43.821,10.278-57.873,28.196l-30.642,39.045c-3.869-1.219-7.984-1.879-12.251-1.879c-4.267,0-8.382,0.66-12.251,1.879 l-30.64-39.043C199.054,10.278,177.959,0,155.234,0c-40.546,0-73.532,32.986-73.532,73.532c0,23.08,10.698,43.701,27.385,57.191 h-62.79c-4.512,0-8.17,3.658-8.17,8.17v87.149c0,4.512,3.658,8.17,8.17,8.17h168.851V495.66H65.362V258.723 c0-4.512-3.658-8.17-8.17-8.17s-8.17,3.658-8.17,8.17V503.83c0,4.512,3.658,8.17,8.17,8.17h397.617c4.513,0,8.17-3.658,8.17-8.17 V234.213h2.723c4.513,0,8.17-3.658,8.17-8.17v-87.149C473.872,134.381,470.215,130.723,465.702,130.723z M457.532,147.064v70.809 H296.851v-70.809H457.532z M311.749,38.282c10.936-13.945,27.344-21.942,45.017-21.942c31.535,0,57.191,25.656,57.191,57.191 s-25.657,57.191-57.191,57.191h-59.915v-16.34h59.915c22.526,0,40.851-18.325,40.851-40.851s-18.325-40.851-40.851-40.851 c-12.619,0-24.344,5.72-32.165,15.692l-31.683,40.37c-2.452-5.161-5.959-9.725-10.236-13.424L311.749,38.282z M306.393,98.043 l31.065-39.583c4.704-5.998,11.742-9.438,19.308-9.438c13.515,0,24.511,10.995,24.511,24.511s-10.996,24.511-24.511,24.511H306.393z M98.043,73.532c0-31.536,25.656-57.191,57.191-57.191c17.673,0,34.081,7.997,45.019,21.944l29.064,37.035 c-4.277,3.698-7.783,8.263-10.236,13.424l-31.688-40.377c-7.818-9.969-19.54-15.686-32.159-15.686 c-22.526,0-40.851,18.325-40.851,40.851s18.325,40.851,40.851,40.851h67.193c0.15,0,0.297-0.014,0.446-0.023 c0.148,0.008,0.295,0.023,0.446,0.023c4.512,0,8.17-3.658,8.17-8.17c0-13.516,10.995-24.511,24.511-24.511 c13.515,0,24.511,10.995,24.511,24.511v24.511H155.233C123.698,130.723,98.043,105.068,98.043,73.532z M205.607,98.043h-50.373 c-13.516,0-24.511-10.995-24.511-24.511s10.995-24.511,24.511-24.511c7.567,0,14.602,3.437,19.302,9.431L205.607,98.043z M54.468,217.872v-70.809h160.681v70.809H54.468z M231.489,147.064h49.021V495.66h-49.021V147.064z M446.638,495.66H296.851V234.213 h149.787V495.66z"></path>
</svg>
<span class="bg-slate-200 h-[100%] w-[50%] absolute group-hover:w-0 left-0 top-0 duration-300 overflow-hidden flex items-center justify-end font-bold">OP</span>
<span class="bg-slate-200 h-[100%] w-[50%] absolute group-hover:w-0 right-0 top-0 duration-500 overflow-hidden flex items-center justify-start font-bold">EN</span>
</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-red-300: oklch(80.8% 0.114 19.571);
--color-red-400: oklch(70.4% 0.191 22.216);
--color-orange-200: oklch(90.1% 0.076 70.697);
--color-yellow-100: oklch(97.3% 0.071 103.193);
--color-yellow-200: oklch(94.5% 0.129 101.54);
--color-slate-200: oklch(92.9% 0.013 255.508);
--color-slate-600: oklch(44.6% 0.043 257.281);
--color-white: #fff;
--spacing: 0.25rem;
--font-weight-bold: 700;
--drop-shadow-xl: 0 9px 7px rgb(0 0 0 / 0.1);
--animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
--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-0 {
top: 0px;
}
.right-0 {
right: 0px;
}
.left-0 {
left: 0px;
}
.flex {
display: flex;
}
.h-\[100\%\] {
height: 100%;
}
.w-\[50\%\] {
width: 50%;
}
.scale-75 {
--tw-scale-x: 75%;
--tw-scale-y: 75%;
--tw-scale-z: 75%;
scale: var(--tw-scale-x) var(--tw-scale-y);
}
.animate-pulse {
animation: var(--animate-pulse);
}
.cursor-pointer {
cursor: pointer;
}
.items-center {
align-items: center;
}
.justify-end {
justify-content: flex-end;
}
.justify-start {
justify-content: flex-start;
}
.overflow-hidden {
overflow: hidden;
}
.rounded-full {
border-radius: calc(infinity * 1px);
}
.border-2 {
border-style: var(--tw-border-style);
border-width: 2px;
}
.border-white {
border-color: var(--color-white);
}
.bg-slate-200 {
background-color: var(--color-slate-200);
}
.bg-gradient-to-tr {
--tw-gradient-position: to top right in oklab;
background-image: linear-gradient(var(--tw-gradient-stops));
}
.from-yellow-100 {
--tw-gradient-from: var(--color-yellow-100);
--tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
}
.to-yellow-200 {
--tw-gradient-to: var(--color-yellow-200);
--tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
}
.fill-none {
fill: none;
}
.fill-orange-200 {
fill: var(--color-orange-200);
}
.fill-red-300 {
fill: var(--color-red-300);
}
.fill-red-400 {
fill: var(--color-red-400);
}
.fill-slate-600 {
fill: var(--color-slate-600);
}
.p-3 {
padding: calc(var(--spacing) * 3);
}
.font-bold {
--tw-font-weight: var(--font-weight-bold);
font-weight: var(--font-weight-bold);
}
.drop-shadow-xl {
--tw-drop-shadow-size: drop-shadow(0 9px 7px var(--tw-drop-shadow-color, rgb(0 0 0 / 0.1)));
--tw-drop-shadow: drop-shadow(var(--drop-shadow-xl));
filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
}
.duration-300 {
--tw-duration: 300ms;
transition-duration: 300ms;
}
.duration-500 {
--tw-duration: 500ms;
transition-duration: 500ms;
}
@media (hover: hover) {
.group-hover\:w-0:is(:where(.group):hover *) {
width: 0px;
}
.group-hover\:scale-100:is(:where(.group):hover *) {
--tw-scale-x: 100%;
--tw-scale-y: 100%;
--tw-scale-z: 100%;
scale: var(--tw-scale-x) var(--tw-scale-y);
}
.group-hover\:rotate-45:is(:where(.group):hover *) {
rotate: 45deg;
}
.hover\:scale-125:hover {
--tw-scale-x: 125%;
--tw-scale-y: 125%;
--tw-scale-z: 125%;
scale: var(--tw-scale-x) var(--tw-scale-y);
}
.hover\:-rotate-45:hover {
rotate: calc(45deg * -1);
}
.hover\:opacity-75:hover {
opacity: 75%;
}
}
.active\:scale-100:active {
--tw-scale-x: 100%;
--tw-scale-y: 100%;
--tw-scale-z: 100%;
scale: var(--tw-scale-x) var(--tw-scale-y);
}
}
@property --tw-scale-x {
syntax: "*";
inherits: false;
initial-value: 1;
}
@property --tw-scale-y {
syntax: "*";
inherits: false;
initial-value: 1;
}
@property --tw-scale-z {
syntax: "*";
inherits: false;
initial-value: 1;
}
@property --tw-border-style {
syntax: "*";
inherits: false;
initial-value: solid;
}
@property --tw-gradient-position {
syntax: "*";
inherits: false;
}
@property --tw-gradient-from {
syntax: "<color>";
inherits: false;
initial-value: #0000;
}
@property --tw-gradient-via {
syntax: "<color>";
inherits: false;
initial-value: #0000;
}
@property --tw-gradient-to {
syntax: "<color>";
inherits: false;
initial-value: #0000;
}
@property --tw-gradient-stops {
syntax: "*";
inherits: false;
}
@property --tw-gradient-via-stops {
syntax: "*";
inherits: false;
}
@property --tw-gradient-from-position {
syntax: "<length-percentage>";
inherits: false;
initial-value: 0%;
}
@property --tw-gradient-via-position {
syntax: "<length-percentage>";
inherits: false;
initial-value: 50%;
}
@property --tw-gradient-to-position {
syntax: "<length-percentage>";
inherits: false;
initial-value: 100%;
}
@property --tw-font-weight {
syntax: "*";
inherits: false;
}
@property --tw-blur {
syntax: "*";
inherits: false;
}
@property --tw-brightness {
syntax: "*";
inherits: false;
}
@property --tw-contrast {
syntax: "*";
inherits: false;
}
@property --tw-grayscale {
syntax: "*";
inherits: false;
}
@property --tw-hue-rotate {
syntax: "*";
inherits: false;
}
@property --tw-invert {
syntax: "*";
inherits: false;
}
@property --tw-opacity {
syntax: "*";
inherits: false;
}
@property --tw-saturate {
syntax: "*";
inherits: false;
}
@property --tw-sepia {
syntax: "*";
inherits: false;
}
@property --tw-drop-shadow {
syntax: "*";
inherits: false;
}
@property --tw-drop-shadow-color {
syntax: "*";
inherits: false;
}
@property --tw-drop-shadow-alpha {
syntax: "<percentage>";
inherits: false;
initial-value: 100%;
}
@property --tw-drop-shadow-size {
syntax: "*";
inherits: false;
}
@property --tw-duration {
syntax: "*";
inherits: false;
}
@keyframes pulse {
50% {
opacity: 0.5;
}
}
@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-scale-x: 1;
--tw-scale-y: 1;
--tw-scale-z: 1;
--tw-border-style: solid;
--tw-gradient-position: initial;
--tw-gradient-from: #0000;
--tw-gradient-via: #0000;
--tw-gradient-to: #0000;
--tw-gradient-stops: initial;
--tw-gradient-via-stops: initial;
--tw-gradient-from-position: 0%;
--tw-gradient-via-position: 50%;
--tw-gradient-to-position: 100%;
--tw-font-weight: initial;
--tw-blur: initial;
--tw-brightness: initial;
--tw-contrast: initial;
--tw-grayscale: initial;
--tw-hue-rotate: initial;
--tw-invert: initial;
--tw-opacity: initial;
--tw-saturate: initial;
--tw-sepia: initial;
--tw-drop-shadow: initial;
--tw-drop-shadow-color: initial;
--tw-drop-shadow-alpha: 100%;
--tw-drop-shadow-size: initial;
--tw-duration: initial;
}
}
}