38 / 47
All 47 in 47 Tailwind CSS Toggles & Switches
- 01Tailwind iOS-Style Toggle Switch with appearance-none
- 02Tailwind Dark Mode Sun / Moon Theme Switcher
- 03Tailwind Neumorphic Soft-UI Pill Toggle
- 04Tailwind Gooey Liquid Morphing Switch with SVG Filter
- 05Tailwind Bouncy Elastic Physics Toggle (Overshoot Cubic-Bezier)
- 06Tailwind ON / OFF Text Switch with Labels Inside the Track
- 07Tailwind SaaS Pricing Toggle — Monthly / Annually Segmented Pill
- 08Tailwind Mechanical Keycap Toggles with Haptic Feedback
- 09Tailwind Waveform Mute Toggle with Animated EQ Bars
- 10Tailwind Timed Auto-Off Toggle with Conic Countdown Ring
- 11Tailwind Press-and-Hold to Confirm Toggle (Fingerprint Scan)
- 12Tailwind Split-Flap Departure Board Toggle (3D Flip)
- 13Tailwind Permission Toggle Group with :has() Live Status Badge
- 14Tailwind Material Design 3 Switch with State Layer
- 15Tailwind Skeuomorphic Wall Light Switch with Room Relight
- 16Tailwind Neon Cyberpunk Toggle with Clipped Corners
- 17Tailwind Brutalist Snap Toggle with Hard Offset Shadow
- 18Tailwind Day / Night Landscape Scene Switch
- 19Tailwind 3D Flip Card Toggle (rotateY Switch)
- 20Tailwind Sliding Pill Toggle with Label Inside the Thumb
- 21Tailwind Glassmorphism Frosted Toggle with backdrop-blur
- 22Tailwind Rotary Knob Toggle with Brushed-Metal Conic Gradient
- 23Tailwind iOS Settings List with Grouped Toggle Rows
- 24Tailwind Minimal Outline Toggle Drawn in currentColor
- 25Tailwind Squash-and-Stretch Pebble Toggle
- 26Tailwind Industrial Rocker I/O Power Switch
- 27Tailwind Accessible role=switch Toggle with forced-colors Support
- 28Tailwind Macro-Pad Toggle Grid with RGB Underglow
- 29Tailwind Radial VU Meter Mute Toggle
- 30Tailwind Segmented Pip Countdown Auto-Off Toggle
- 31Tailwind Slide-to-Confirm Toggle Rail (Drag or Arrow Keys)
- 32Tailwind Odometer Roll ON / OFF Toggle
- 33Tailwind Master Toggle with Indeterminate Tri-State
- 34Tailwind iOS Control Centre Tile Toggles
- 35Tailwind Material 3 Connected Icon Toggle Buttons
- 36Tailwind Two-Gang Wall Plate with Cumulative Room Light
- 37Tailwind Neon Toggle with Animated Conic Border Light
- 38Tailwind Brutalist Rubber-Stamp Toggle
- 39Tailwind Aurora Night Sky Toggle Switch
- 40Tailwind 3D Rotating Cube Toggle
- 41Tailwind Three-Position Off / Auto / On Selector
- 42Tailwind Liquid Glass Toggle with Specular Highlight
- 43Tailwind Three-Detent Rotary Selector Knob
- 44Tailwind Hardware Slide Switch with Knurled Grip
- 45Tailwind Battery Saver Toggle with Live Fill Meter
- 46Tailwind Morphing Sun-to-Moon Icon Toggle (SVG Stroke)
- 47Tailwind Guarded Kill Switch Under a Flip-Up Safety Cover
Tailwind Brutalist Rubber-Stamp Toggle
Checking it stamps: a rotated APPROVED block slams down over the card with a scale-and-settle keyframe, borders 3px, shadow hard and offset. Where demo 17 snaps a thumb, this one commits an act — the state looks like a decision that was made.
Untitled UI Pro: 5,000+ React + Tailwind CSS v4 components · from $349 one-time
Untitled UI React · Affiliate link
The code
<section class="ttg-38 w-full min-h-svh grid place-items-center px-8 py-16 bg-ttg38-bg font-ttg38-mono" aria-label="Brutalist stamp toggle">
<div class="relative">
<input type="checkbox" id="ttg-38-sw" role="switch" aria-label="Approve expense report" class="peer sr-only">
<label for="ttg-38-sw" class="flex flex-col gap-5 w-[min(340px,100%)] p-7 bg-white border-[3px] border-ttg38-line cursor-pointer shadow-[8px_8px_0_var(--color-ttg38-line)] transition-[background-color,box-shadow] duration-[90ms] ease-[steps(1,end)] active:translate-x-1 active:translate-y-1 active:shadow-[4px_4px_0_var(--color-ttg38-line)] peer-checked:bg-ttg38-paperon peer-focus-visible:outline-4 peer-focus-visible:outline-ttg38-line peer-focus-visible:outline-offset-4 peer-checked:[&_.ttg38-track]:bg-ttg38-ink peer-checked:[&_.ttg38-thumb]:translate-x-[40px] motion-reduce:transition-none">
<span class="flex flex-col gap-1">
<b class="text-[11px] font-bold tracking-[0.22em] text-ttg38-muted">EXPENSE / 4471</b>
<span class="text-[19px] font-extrabold tracking-[-0.01em] text-ttg38-line leading-tight">Q3 hardware — $2,480</span>
</span>
<span class="flex items-center justify-between gap-4 pt-4 border-t-[3px] border-ttg38-line">
<span class="text-[13px] font-bold tracking-[0.12em] text-ttg38-line">APPROVE</span>
<span aria-hidden="true" class="ttg38-track block w-20 h-10 border-[3px] border-ttg38-line bg-white relative transition-colors duration-[90ms] ease-[steps(1,end)]">
<i class="ttg38-thumb absolute top-0.5 left-0.5 block w-7 h-7 bg-ttg38-line transition-transform duration-[90ms] ease-[steps(1,end)]"></i>
</span>
</span>
</label>
<span aria-hidden="true" class="ttg38-stamp pointer-events-none peer-checked:opacity-100 peer-checked:animate-ttg38-slam motion-reduce:peer-checked:animate-none absolute -top-5 -right-6 grid place-items-center px-5 py-2.5 opacity-0 -rotate-[14deg] border-[5px] border-ttg38-ink outline-4 outline-ttg38-ink outline-offset-[-10px] text-[22px] font-extrabold tracking-[0.14em] text-ttg38-ink">APPROVED</span>
</div>
</section><section class="ttg-38 w-full min-h-svh grid place-items-center px-8 py-16 bg-ttg38-bg font-ttg38-mono" aria-label="Brutalist stamp toggle">
<div class="relative">
<input type="checkbox" id="ttg-38-sw" role="switch" aria-label="Approve expense report" class="peer sr-only">
<label for="ttg-38-sw" class="flex flex-col gap-5 w-[min(340px,100%)] p-7 bg-white border-[3px] border-ttg38-line cursor-pointer shadow-[8px_8px_0_var(--color-ttg38-line)] transition-[background-color,box-shadow] duration-[90ms] ease-[steps(1,end)] active:translate-x-1 active:translate-y-1 active:shadow-[4px_4px_0_var(--color-ttg38-line)] peer-checked:bg-ttg38-paperon peer-focus-visible:outline-4 peer-focus-visible:outline-ttg38-line peer-focus-visible:outline-offset-4 peer-checked:[&_.ttg38-track]:bg-ttg38-ink peer-checked:[&_.ttg38-thumb]:translate-x-[40px] motion-reduce:transition-none">
<span class="flex flex-col gap-1">
<b class="text-[11px] font-bold tracking-[0.22em] text-ttg38-muted">EXPENSE / 4471</b>
<span class="text-[19px] font-extrabold tracking-[-0.01em] text-ttg38-line leading-tight">Q3 hardware — $2,480</span>
</span>
<span class="flex items-center justify-between gap-4 pt-4 border-t-[3px] border-ttg38-line">
<span class="text-[13px] font-bold tracking-[0.12em] text-ttg38-line">APPROVE</span>
<span aria-hidden="true" class="ttg38-track block w-20 h-10 border-[3px] border-ttg38-line bg-white relative transition-colors duration-[90ms] ease-[steps(1,end)]">
<i class="ttg38-thumb absolute top-0.5 left-0.5 block w-7 h-7 bg-ttg38-line transition-transform duration-[90ms] ease-[steps(1,end)]"></i>
</span>
</span>
</label>
<span aria-hidden="true" class="ttg38-stamp pointer-events-none peer-checked:opacity-100 peer-checked:animate-ttg38-slam motion-reduce:peer-checked:animate-none absolute -top-5 -right-6 grid place-items-center px-5 py-2.5 opacity-0 -rotate-[14deg] border-[5px] border-ttg38-ink outline-4 outline-ttg38-ink outline-offset-[-10px] text-[22px] font-extrabold tracking-[0.14em] text-ttg38-ink">APPROVED</span>
</div>
</section>@import "tailwindcss";
@theme {
--color-ttg38-bg: #ece8dd;
--color-ttg38-bg: oklch(0.93 0.012 90);
--color-ttg38-line: #000000;
--color-ttg38-line: oklch(0 0 0);
--color-ttg38-ink: #c2261f;
--color-ttg38-ink: oklch(0.5 0.2 27);
--color-ttg38-paperon: #fdf6e8;
--color-ttg38-paperon: oklch(0.97 0.02 88);
--color-ttg38-muted: #57534a;
--color-ttg38-muted: oklch(0.45 0.012 90);
--font-ttg38-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
--animate-ttg38-slam: ttg38-slam 0.26s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
@keyframes ttg38-slam {
0% {
opacity: 0;
transform: rotate(-14deg) scale(2.4);
}
60% {
opacity: 1;
transform: rotate(-14deg) scale(0.92);
}
100% {
opacity: 1;
transform: rotate(-14deg) scale(1);
}
}
.ttg-38 {
width: 100%;
min-height: 100svh;
}
/* The stamp is a sibling of the label, not a descendant, so the peer state reaches it
directly — and it must stay visible after the animation under reduced motion. */
@media (prefers-reduced-motion: reduce) {
.ttg-38 .peer:checked ~ .ttg38-stamp {
opacity: 1;
transform: rotate(-14deg) scale(1);
}
}@import "tailwindcss";
@theme {
--color-ttg38-bg: #ece8dd;
--color-ttg38-bg: oklch(0.93 0.012 90);
--color-ttg38-line: #000000;
--color-ttg38-line: oklch(0 0 0);
--color-ttg38-ink: #c2261f;
--color-ttg38-ink: oklch(0.5 0.2 27);
--color-ttg38-paperon: #fdf6e8;
--color-ttg38-paperon: oklch(0.97 0.02 88);
--color-ttg38-muted: #57534a;
--color-ttg38-muted: oklch(0.45 0.012 90);
--font-ttg38-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
--animate-ttg38-slam: ttg38-slam 0.26s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
@keyframes ttg38-slam {
0% {
opacity: 0;
transform: rotate(-14deg) scale(2.4);
}
60% {
opacity: 1;
transform: rotate(-14deg) scale(0.92);
}
100% {
opacity: 1;
transform: rotate(-14deg) scale(1);
}
}
.ttg-38 {
width: 100%;
min-height: 100svh;
}
/* The stamp is a sibling of the label, not a descendant, so the peer state reaches it
directly — and it must stay visible after the animation under reduced motion. */
@media (prefers-reduced-motion: reduce) {
.ttg-38 .peer:checked ~ .ttg38-stamp {
opacity: 1;
transform: rotate(-14deg) scale(1);
}
}Setup — do this once per project
Skip this if your project already runs Tailwind v4.
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>Compiles in the browser — perfect for a CodePen or a quick test, not for production.
npm install tailwindcss @tailwindcss/vite
npm install tailwindcss @tailwindcss/vite// vite.config.js ("type": "module" in package.json)
import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [tailwindcss()],
})// vite.config.js ("type": "module" in package.json)
import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [tailwindcss()],
})Any v4 setup works — Vite, PostCSS or the CLI. Nothing in this demo is bundler-specific.
@import "tailwindcss";
@theme {
--color-ttg38-bg: #ece8dd;
--color-ttg38-bg: oklch(0.93 0.012 90);
--color-ttg38-line: #000000;
--color-ttg38-line: oklch(0 0 0);
--color-ttg38-ink: #c2261f;
--color-ttg38-ink: oklch(0.5 0.2 27);
--color-ttg38-paperon: #fdf6e8;
--color-ttg38-paperon: oklch(0.97 0.02 88);
--color-ttg38-muted: #57534a;
--color-ttg38-muted: oklch(0.45 0.012 90);
--font-ttg38-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
--animate-ttg38-slam: ttg38-slam 0.26s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
@keyframes ttg38-slam {
0% {
opacity: 0;
transform: rotate(-14deg) scale(2.4);
}
60% {
opacity: 1;
transform: rotate(-14deg) scale(0.92);
}
100% {
opacity: 1;
transform: rotate(-14deg) scale(1);
}
}
.ttg-38 {
width: 100%;
min-height: 100svh;
}
/* The stamp is a sibling of the label, not a descendant, so the peer state reaches it
directly — and it must stay visible after the animation under reduced motion. */
@media (prefers-reduced-motion: reduce) {
.ttg-38 .peer:checked ~ .ttg38-stamp {
opacity: 1;
transform: rotate(-14deg) scale(1);
}
}@import "tailwindcss";
@theme {
--color-ttg38-bg: #ece8dd;
--color-ttg38-bg: oklch(0.93 0.012 90);
--color-ttg38-line: #000000;
--color-ttg38-line: oklch(0 0 0);
--color-ttg38-ink: #c2261f;
--color-ttg38-ink: oklch(0.5 0.2 27);
--color-ttg38-paperon: #fdf6e8;
--color-ttg38-paperon: oklch(0.97 0.02 88);
--color-ttg38-muted: #57534a;
--color-ttg38-muted: oklch(0.45 0.012 90);
--font-ttg38-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
--animate-ttg38-slam: ttg38-slam 0.26s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
@keyframes ttg38-slam {
0% {
opacity: 0;
transform: rotate(-14deg) scale(2.4);
}
60% {
opacity: 1;
transform: rotate(-14deg) scale(0.92);
}
100% {
opacity: 1;
transform: rotate(-14deg) scale(1);
}
}
.ttg-38 {
width: 100%;
min-height: 100svh;
}
/* The stamp is a sibling of the label, not a descendant, so the peer state reaches it
directly — and it must stay visible after the animation under reduced motion. */
@media (prefers-reduced-motion: reduce) {
.ttg-38 .peer:checked ~ .ttg38-stamp {
opacity: 1;
transform: rotate(-14deg) scale(1);
}
}<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700;800&display=swap">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700;800&display=swap">What changed in the port
Which parts became utilities, which stayed CSS, and why.
- Every keyframe restates
rotate(-14deg). A transform keyframe replaces the whole property, so omitting the rotation in one frame un-rotates the stamp mid-slam — the most common bug when animating one part of a compound transform. - The stamp sits OUTSIDE the label as a peer sibling, which is what lets it overlap the card's corner without being clipped by the label's own box.
outline-offset-[-10px]draws the inner rule of the stamp without a second element — negative outline offsets are underused and exactly right for double-ruled borders.- UI upgrade over demo 17: the state now reads as an action performed on a document rather than a pill flipping, the card carries real content (an expense line) so the switch has a consequence, and the muted ink is
oklch(0.45)for 8.9:1 against paper.
Here's a working CSS demo from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Tailwind Brutalist Rubber-Stamp Toggle
Source: https://codefronts.com/components/tailwind-css-toggles-switches/tailwind-brutalist-rubber-stamp-toggle/
Checking it stamps: a rotated APPROVED block slams down over the card with a scale-and-settle keyframe, borders 3px, shadow hard and offset. Where demo 17 snaps a thumb, this one commits an act — the state looks like a decision that was made.
## HTML
```html
<section class="ttg-38 w-full min-h-svh grid place-items-center px-8 py-16 bg-ttg38-bg font-ttg38-mono" aria-label="Brutalist stamp toggle">
<div class="relative">
<input type="checkbox" id="ttg-38-sw" role="switch" aria-label="Approve expense report" class="peer sr-only">
<label for="ttg-38-sw" class="flex flex-col gap-5 w-[min(340px,100%)] p-7 bg-white border-[3px] border-ttg38-line cursor-pointer shadow-[8px_8px_0_var(--color-ttg38-line)] transition-[background-color,box-shadow] duration-[90ms] ease-[steps(1,end)] active:translate-x-1 active:translate-y-1 active:shadow-[4px_4px_0_var(--color-ttg38-line)] peer-checked:bg-ttg38-paperon peer-focus-visible:outline-4 peer-focus-visible:outline-ttg38-line peer-focus-visible:outline-offset-4 peer-checked:[&_.ttg38-track]:bg-ttg38-ink peer-checked:[&_.ttg38-thumb]:translate-x-[40px] motion-reduce:transition-none">
<span class="flex flex-col gap-1">
<b class="text-[11px] font-bold tracking-[0.22em] text-ttg38-muted">EXPENSE / 4471</b>
<span class="text-[19px] font-extrabold tracking-[-0.01em] text-ttg38-line leading-tight">Q3 hardware — $2,480</span>
</span>
<span class="flex items-center justify-between gap-4 pt-4 border-t-[3px] border-ttg38-line">
<span class="text-[13px] font-bold tracking-[0.12em] text-ttg38-line">APPROVE</span>
<span aria-hidden="true" class="ttg38-track block w-20 h-10 border-[3px] border-ttg38-line bg-white relative transition-colors duration-[90ms] ease-[steps(1,end)]">
<i class="ttg38-thumb absolute top-0.5 left-0.5 block w-7 h-7 bg-ttg38-line transition-transform duration-[90ms] ease-[steps(1,end)]"></i>
</span>
</span>
</label>
<span aria-hidden="true" class="ttg38-stamp pointer-events-none peer-checked:opacity-100 peer-checked:animate-ttg38-slam motion-reduce:peer-checked:animate-none absolute -top-5 -right-6 grid place-items-center px-5 py-2.5 opacity-0 -rotate-[14deg] border-[5px] border-ttg38-ink outline-4 outline-ttg38-ink outline-offset-[-10px] text-[22px] font-extrabold tracking-[0.14em] text-ttg38-ink">APPROVED</span>
</div>
</section>
```
## CSS
```css
@import "tailwindcss";
@theme {
--color-ttg38-bg: #ece8dd;
--color-ttg38-bg: oklch(0.93 0.012 90);
--color-ttg38-line: #000000;
--color-ttg38-line: oklch(0 0 0);
--color-ttg38-ink: #c2261f;
--color-ttg38-ink: oklch(0.5 0.2 27);
--color-ttg38-paperon: #fdf6e8;
--color-ttg38-paperon: oklch(0.97 0.02 88);
--color-ttg38-muted: #57534a;
--color-ttg38-muted: oklch(0.45 0.012 90);
--font-ttg38-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
--animate-ttg38-slam: ttg38-slam 0.26s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
@keyframes ttg38-slam {
0% {
opacity: 0;
transform: rotate(-14deg) scale(2.4);
}
60% {
opacity: 1;
transform: rotate(-14deg) scale(0.92);
}
100% {
opacity: 1;
transform: rotate(-14deg) scale(1);
}
}
.ttg-38 {
width: 100%;
min-height: 100svh;
}
/* The stamp is a sibling of the label, not a descendant, so the peer state reaches it
directly — and it must stay visible after the animation under reduced motion. */
@media (prefers-reduced-motion: reduce) {
.ttg-38 .peer:checked ~ .ttg38-stamp {
opacity: 1;
transform: rotate(-14deg) scale(1);
}
}
```Here's a working CSS demo from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Tailwind Brutalist Rubber-Stamp Toggle
Source: https://codefronts.com/components/tailwind-css-toggles-switches/tailwind-brutalist-rubber-stamp-toggle/
Checking it stamps: a rotated APPROVED block slams down over the card with a scale-and-settle keyframe, borders 3px, shadow hard and offset. Where demo 17 snaps a thumb, this one commits an act — the state looks like a decision that was made.
## HTML
```html
<section class="ttg-38 w-full min-h-svh grid place-items-center px-8 py-16 bg-ttg38-bg font-ttg38-mono" aria-label="Brutalist stamp toggle">
<div class="relative">
<input type="checkbox" id="ttg-38-sw" role="switch" aria-label="Approve expense report" class="peer sr-only">
<label for="ttg-38-sw" class="flex flex-col gap-5 w-[min(340px,100%)] p-7 bg-white border-[3px] border-ttg38-line cursor-pointer shadow-[8px_8px_0_var(--color-ttg38-line)] transition-[background-color,box-shadow] duration-[90ms] ease-[steps(1,end)] active:translate-x-1 active:translate-y-1 active:shadow-[4px_4px_0_var(--color-ttg38-line)] peer-checked:bg-ttg38-paperon peer-focus-visible:outline-4 peer-focus-visible:outline-ttg38-line peer-focus-visible:outline-offset-4 peer-checked:[&_.ttg38-track]:bg-ttg38-ink peer-checked:[&_.ttg38-thumb]:translate-x-[40px] motion-reduce:transition-none">
<span class="flex flex-col gap-1">
<b class="text-[11px] font-bold tracking-[0.22em] text-ttg38-muted">EXPENSE / 4471</b>
<span class="text-[19px] font-extrabold tracking-[-0.01em] text-ttg38-line leading-tight">Q3 hardware — $2,480</span>
</span>
<span class="flex items-center justify-between gap-4 pt-4 border-t-[3px] border-ttg38-line">
<span class="text-[13px] font-bold tracking-[0.12em] text-ttg38-line">APPROVE</span>
<span aria-hidden="true" class="ttg38-track block w-20 h-10 border-[3px] border-ttg38-line bg-white relative transition-colors duration-[90ms] ease-[steps(1,end)]">
<i class="ttg38-thumb absolute top-0.5 left-0.5 block w-7 h-7 bg-ttg38-line transition-transform duration-[90ms] ease-[steps(1,end)]"></i>
</span>
</span>
</label>
<span aria-hidden="true" class="ttg38-stamp pointer-events-none peer-checked:opacity-100 peer-checked:animate-ttg38-slam motion-reduce:peer-checked:animate-none absolute -top-5 -right-6 grid place-items-center px-5 py-2.5 opacity-0 -rotate-[14deg] border-[5px] border-ttg38-ink outline-4 outline-ttg38-ink outline-offset-[-10px] text-[22px] font-extrabold tracking-[0.14em] text-ttg38-ink">APPROVED</span>
</div>
</section>
```
## CSS
```css
@import "tailwindcss";
@theme {
--color-ttg38-bg: #ece8dd;
--color-ttg38-bg: oklch(0.93 0.012 90);
--color-ttg38-line: #000000;
--color-ttg38-line: oklch(0 0 0);
--color-ttg38-ink: #c2261f;
--color-ttg38-ink: oklch(0.5 0.2 27);
--color-ttg38-paperon: #fdf6e8;
--color-ttg38-paperon: oklch(0.97 0.02 88);
--color-ttg38-muted: #57534a;
--color-ttg38-muted: oklch(0.45 0.012 90);
--font-ttg38-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
--animate-ttg38-slam: ttg38-slam 0.26s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
@keyframes ttg38-slam {
0% {
opacity: 0;
transform: rotate(-14deg) scale(2.4);
}
60% {
opacity: 1;
transform: rotate(-14deg) scale(0.92);
}
100% {
opacity: 1;
transform: rotate(-14deg) scale(1);
}
}
.ttg-38 {
width: 100%;
min-height: 100svh;
}
/* The stamp is a sibling of the label, not a descendant, so the peer state reaches it
directly — and it must stay visible after the animation under reduced motion. */
@media (prefers-reduced-motion: reduce) {
.ttg-38 .peer:checked ~ .ttg38-stamp {
opacity: 1;
transform: rotate(-14deg) scale(1);
}
}
```How this works
The slam is three keyframes. Enormous and transparent, then overshooting small and opaque, then settled at 1. It is under 300ms and uses no easing curve worth naming — the impact comes from the scale ratio, not the timing function.
The stamp is absolutely positioned and rotated, overlapping the card's edge so it reads as applied ON TOP of the document rather than laid out inside it. Overlap is doing most of the work; without it the effect is a badge.
The switch underneath is deliberately plain. A 3px-bordered square with a black block thumb, no radius anywhere. The stamp is the decoration budget for this demo, and spending it twice would make both look cheap.
Make it yours
- Change the word: VOID, PAID, DRAFT, REJECTED. Keep it one short word in heavy caps.
- Ink colour through
--color-ttg38-ink; the stamp, its double rule and the card border all read it. - Rougher edge: add a subtle
maskof noise for the classic imperfect-ink look. - Remove the rotation for an audit-log aesthetic — level stamps read as systematic.
Gotchas — read before shipping
- The stamp is decorative and must be
aria-hidden; the state a screen reader hears comes from the checkbox, and hearing "APPROVED" as a separate label is confusing. - Keep the slam under ~300ms. A slow stamp reads as a modal appearing.
- Under
motion-reduce:the stamp must still APPEAR, just without the scale — removing the animation entirely would delete the state. - An overlapping rotated element needs the card to have room; give the layout padding, or the stamp clips on narrow screens.
Browser support
| Chrome | Safari | Firefox | Edge |
|---|---|---|---|
| 111+ | 16.4+ | 128+ | 111+ |
Transforms and keyframes only; works everywhere modern with no feature-query fallback needed.