41 / 51
All 51 in 51 Tailwind CSS Buttons
- 01Tailwind Submit Button (Form Primary)
- 02Tailwind Primary and Secondary Button Pair
- 03Tailwind Ghost / Outline Button
- 04Tailwind Icon-Only Button with Accessible Tooltip
- 05Tailwind Gradient CTA Button
- 06Tailwind Loading Spinner Button (State Transition)
- 07Tailwind Disabled Button State (Full State Reference)
- 08Tailwind Button Group Component (Segmented Radio-Like)
- 09Tailwind Add to Cart Button
- 10Tailwind Download Progress Button
- 11Tailwind Like Heart Button
- 12Tailwind Confirm Delete Button
- 13Tailwind Play Pause Button
- 14Tailwind Subscribe Confetti Button
- 15Tailwind Magnetic Mercury Ripple Button
- 16Tailwind Brutalist Glitch Button
- 17Tailwind Neon Plasma Burst Button
- 18Tailwind Clay Press Button
- 19Tailwind Editorial Ink Spread Button
- 20Tailwind Particle Shard Burst Button
- 21Tailwind Brushed Brass Plate Button
- 22Tailwind Washi Paper Crane Button
- 23Tailwind Frosted Ice Cube Button
- 24Tailwind Vintage Typewriter Key Button
- 25Tailwind Lacquered Walnut Wood Button
- 26Tailwind Pharma Gel Capsule Button
- 27Tailwind Aged Copper Coin Button
- 28Tailwind Origami Fortune Cookie Button
- 29Tailwind Holographic Foil Sticker Button
- 30Tailwind Brutalist Concrete Slab Button
- 31Tailwind Mercury Bead Morph Button
- 32Tailwind Soft Pill Modern SaaS Button
- 33Tailwind Masking Tape Label Button
- 34Tailwind Obsidian Glass Shard Button
- 35Tailwind Wine Velvet Ribbon Button
- 36Tailwind LED Segment Display Button
- 37Tailwind Cassette Mixtape Label Button
- 38Tailwind Chalkboard Menu Button
- 39Tailwind Vinyl Record Sleeve Ripple Button
- 40Tailwind Polaroid Snapshot Button
- 41Tailwind Airline Boarding Pass Button
- 42Tailwind Aged Brass Subway Token Button
- 43Tailwind Vintage Rx Pharmacy Label Button
- 44Tailwind Bakelite Radio Dial Toggle Button
- 45Tailwind Regal Postage Stamp Button
- 46Tailwind Victorian Cigar Band Foil Button
- 47Tailwind Vintage Calculator Key Button
- 48Tailwind Toolbox Latch Spotlight Button
- 49Tailwind Receipt Paper Total Count-Up Button
- 50Tailwind IBM Punch Card Magnetic Follow Button
- 51Tailwind Brass Periscope Lens Button
Tailwind Airline Boarding Pass Button
A boarding pass with a genuinely perforated seam: a mask punches half-circles down the divide, the stub tears away and rotates on hover, and a barcode is drawn with one repeating gradient. Flight numbers use tabular-nums so nothing shifts as they change.
Untitled UI Pro: 5,000+ React + Tailwind CSS v4 components · from $349 one-time
Untitled UI React · Affiliate link
The code
<div class="tb-41 w-full min-h-svh grid place-items-center font-tb41-sans antialiased p-[clamp(1.5rem,6vw,4rem)]">
<button type="button" class="group relative cursor-pointer border-0 p-0 bg-transparent grid grid-cols-[1fr_auto] items-stretch w-[min(100%,30rem)] text-left text-tb41-ink drop-shadow-[0_18px_26px_#0000008c] transition-[translate,filter] duration-[350ms] ease-tb41-out [-webkit-tap-highlight-color:transparent] hover:-translate-y-[3px] hover:drop-shadow-[0_26px_34px_#00000099] focus-visible:-translate-y-[3px] focus-visible:outline-2 focus-visible:outline-offset-[5px] focus-visible:outline-tb41-brand active:translate-y-px disabled:cursor-not-allowed disabled:grayscale-[0.6] motion-reduce:transition-none">
<span class="tb-41__body grid gap-3 px-4.5 pt-4 pb-4.5 rounded-l-[0.6rem] border-r border-dashed border-tb41-seam">
<span class="flex items-baseline justify-between gap-3">
<span class="text-xs font-extrabold tracking-[0.16em] uppercase text-tb41-brand">Meridian Air</span>
<span class="text-[0.6875rem] font-semibold tracking-[0.06em] tabular-nums text-tb41-muted">14A · Zone 2</span>
</span>
<span class="flex items-center gap-3">
<span class="text-3xl font-extrabold tracking-[-0.02em] leading-none">LHR</span>
<svg viewBox="0 0 24 24" aria-hidden="true" fill="currentColor" class="size-5 text-tb41-brand transition-transform duration-500 ease-tb41-out group-hover:translate-x-1.5 group-focus-visible:translate-x-1.5 motion-reduce:transition-none"><path d="M2 13.5 22 9l-1 3.2-6.6 2.2-2.2 5.1-2.1.6 1-5-6.6 2.2L2 13.5z"/></svg>
<span class="text-3xl font-extrabold tracking-[-0.02em] leading-none">JFK</span>
</span>
<span class="flex flex-wrap gap-x-4.5 gap-y-1.5 text-xs tabular-nums text-tb41-muted">
<span>Boards <b class="font-bold text-tb41-ink">18:40</b></span>
<span>Gate <b class="font-bold text-tb41-ink">B22</b></span>
<span>Flt <b class="font-bold text-tb41-ink">MA 214</b></span>
</span>
</span>
<span class="tb-41__stub grid gap-2 justify-items-center content-center px-3.5 py-4 rounded-r-[0.6rem] origin-left transition-[rotate,translate] duration-[450ms] ease-tb41-out group-hover:rotate-[3.5deg] group-hover:translate-x-[0.4rem] group-focus-visible:rotate-[3.5deg] group-focus-visible:translate-x-[0.4rem] motion-reduce:transition-none">
<span class="text-[0.625rem] font-extrabold tracking-[0.14em] uppercase text-center text-tb41-brand">Tap to check in</span>
<span aria-hidden="true" class="block w-18 h-10 bg-[repeating-linear-gradient(90deg,var(--color-tb41-ink)_0_2px,transparent_2px_4px,var(--color-tb41-ink)_4px_5px,transparent_5px_8px,var(--color-tb41-ink)_8px_11px,transparent_11px_12px,var(--color-tb41-ink)_12px_13px,transparent_13px_16px)]"></span>
<span class="text-[0.9375rem] font-extrabold tracking-[0.04em] tabular-nums">14A</span>
</span>
</button>
</div><div class="tb-41 w-full min-h-svh grid place-items-center font-tb41-sans antialiased p-[clamp(1.5rem,6vw,4rem)]">
<button type="button" class="group relative cursor-pointer border-0 p-0 bg-transparent grid grid-cols-[1fr_auto] items-stretch w-[min(100%,30rem)] text-left text-tb41-ink drop-shadow-[0_18px_26px_#0000008c] transition-[translate,filter] duration-[350ms] ease-tb41-out [-webkit-tap-highlight-color:transparent] hover:-translate-y-[3px] hover:drop-shadow-[0_26px_34px_#00000099] focus-visible:-translate-y-[3px] focus-visible:outline-2 focus-visible:outline-offset-[5px] focus-visible:outline-tb41-brand active:translate-y-px disabled:cursor-not-allowed disabled:grayscale-[0.6] motion-reduce:transition-none">
<span class="tb-41__body grid gap-3 px-4.5 pt-4 pb-4.5 rounded-l-[0.6rem] border-r border-dashed border-tb41-seam">
<span class="flex items-baseline justify-between gap-3">
<span class="text-xs font-extrabold tracking-[0.16em] uppercase text-tb41-brand">Meridian Air</span>
<span class="text-[0.6875rem] font-semibold tracking-[0.06em] tabular-nums text-tb41-muted">14A · Zone 2</span>
</span>
<span class="flex items-center gap-3">
<span class="text-3xl font-extrabold tracking-[-0.02em] leading-none">LHR</span>
<svg viewBox="0 0 24 24" aria-hidden="true" fill="currentColor" class="size-5 text-tb41-brand transition-transform duration-500 ease-tb41-out group-hover:translate-x-1.5 group-focus-visible:translate-x-1.5 motion-reduce:transition-none"><path d="M2 13.5 22 9l-1 3.2-6.6 2.2-2.2 5.1-2.1.6 1-5-6.6 2.2L2 13.5z"/></svg>
<span class="text-3xl font-extrabold tracking-[-0.02em] leading-none">JFK</span>
</span>
<span class="flex flex-wrap gap-x-4.5 gap-y-1.5 text-xs tabular-nums text-tb41-muted">
<span>Boards <b class="font-bold text-tb41-ink">18:40</b></span>
<span>Gate <b class="font-bold text-tb41-ink">B22</b></span>
<span>Flt <b class="font-bold text-tb41-ink">MA 214</b></span>
</span>
</span>
<span class="tb-41__stub grid gap-2 justify-items-center content-center px-3.5 py-4 rounded-r-[0.6rem] origin-left transition-[rotate,translate] duration-[450ms] ease-tb41-out group-hover:rotate-[3.5deg] group-hover:translate-x-[0.4rem] group-focus-visible:rotate-[3.5deg] group-focus-visible:translate-x-[0.4rem] motion-reduce:transition-none">
<span class="text-[0.625rem] font-extrabold tracking-[0.14em] uppercase text-center text-tb41-brand">Tap to check in</span>
<span aria-hidden="true" class="block w-18 h-10 bg-[repeating-linear-gradient(90deg,var(--color-tb41-ink)_0_2px,transparent_2px_4px,var(--color-tb41-ink)_4px_5px,transparent_5px_8px,var(--color-tb41-ink)_8px_11px,transparent_11px_12px,var(--color-tb41-ink)_12px_13px,transparent_13px_16px)]"></span>
<span class="text-[0.9375rem] font-extrabold tracking-[0.04em] tabular-nums">14A</span>
</span>
</button>
</div>@import "tailwindcss";
@theme {
--color-tb41-bg: #0e1b24;
--color-tb41-bg: oklch(0.22 0.03 235);
--color-tb41-card: #fbfbf8;
--color-tb41-card: oklch(0.985 0.004 90);
--color-tb41-card-lo: #eceae2;
--color-tb41-card-lo: oklch(0.93 0.006 90);
--color-tb41-ink: #131a20;
--color-tb41-ink: oklch(0.2 0.015 240);
--color-tb41-muted: #5b646f;
--color-tb41-muted: oklch(0.47 0.015 240);
--color-tb41-brand: #0f5f7a;
--color-tb41-brand: oklch(0.45 0.09 217);
--color-tb41-seam: #131a2047;
--color-tb41-seam: oklch(0.2 0.015 240 / 0.28);
--font-tb41-sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
--ease-tb41-out: cubic-bezier(0.16, 1, 0.3, 1);
}
.tb-41 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: radial-gradient(38rem 24rem at 50% 30%, #16303e, transparent 72%), var(--color-tb41-bg);
}
.tb-41__body,
.tb-41__stub {
background: linear-gradient(170deg, var(--color-tb41-card), var(--color-tb41-card-lo));
}
/* THE PERFORATION. Each piece carries its OWN half of the seam, on its own edge.
Masking the whole button instead leaves the dot column behind in the button's
coordinate space — so once the stub rotates, the holes stop following it and
start slicing its corners. XOR, not intersect: intersect would erase everything
except the .6rem dot column. */
@supports ((mask-composite: exclude) or (-webkit-mask-composite: xor)) {
.tb-41__body {
-webkit-mask: radial-gradient(.3rem .3rem at 100% 50%, #000 96%, transparent 0) 100% -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
mask: radial-gradient(.3rem .3rem at 100% 50%, #000 96%, transparent 0) 100% -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
-webkit-mask-composite: xor;
mask-composite: exclude;
border-right: 0;
}
.tb-41__stub {
-webkit-mask: radial-gradient(.3rem .3rem at 0 50%, #000 96%, transparent 0) 0 -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
mask: radial-gradient(.3rem .3rem at 0 50%, #000 96%, transparent 0) 0 -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
-webkit-mask-composite: xor;
mask-composite: exclude;
}
}
@media (prefers-color-scheme: light) {
.tb-41:not([data-theme="dark"]) {
--color-tb41-bg: oklch(0.3 0.04 235);
}
}
.tb-41[data-theme="light"] {
--color-tb41-bg: oklch(0.3 0.04 235);
}
@media (forced-colors: active) {
.tb-41 button {
mask: none;
-webkit-mask: none;
filter: none;
}
.tb-41__body,
.tb-41__stub {
background: ButtonFace;
border: 1px solid ButtonText;
color: ButtonText;
}
.tb-41__stub span[aria-hidden] {
background: ButtonText;
}
}@import "tailwindcss";
@theme {
--color-tb41-bg: #0e1b24;
--color-tb41-bg: oklch(0.22 0.03 235);
--color-tb41-card: #fbfbf8;
--color-tb41-card: oklch(0.985 0.004 90);
--color-tb41-card-lo: #eceae2;
--color-tb41-card-lo: oklch(0.93 0.006 90);
--color-tb41-ink: #131a20;
--color-tb41-ink: oklch(0.2 0.015 240);
--color-tb41-muted: #5b646f;
--color-tb41-muted: oklch(0.47 0.015 240);
--color-tb41-brand: #0f5f7a;
--color-tb41-brand: oklch(0.45 0.09 217);
--color-tb41-seam: #131a2047;
--color-tb41-seam: oklch(0.2 0.015 240 / 0.28);
--font-tb41-sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
--ease-tb41-out: cubic-bezier(0.16, 1, 0.3, 1);
}
.tb-41 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: radial-gradient(38rem 24rem at 50% 30%, #16303e, transparent 72%), var(--color-tb41-bg);
}
.tb-41__body,
.tb-41__stub {
background: linear-gradient(170deg, var(--color-tb41-card), var(--color-tb41-card-lo));
}
/* THE PERFORATION. Each piece carries its OWN half of the seam, on its own edge.
Masking the whole button instead leaves the dot column behind in the button's
coordinate space — so once the stub rotates, the holes stop following it and
start slicing its corners. XOR, not intersect: intersect would erase everything
except the .6rem dot column. */
@supports ((mask-composite: exclude) or (-webkit-mask-composite: xor)) {
.tb-41__body {
-webkit-mask: radial-gradient(.3rem .3rem at 100% 50%, #000 96%, transparent 0) 100% -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
mask: radial-gradient(.3rem .3rem at 100% 50%, #000 96%, transparent 0) 100% -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
-webkit-mask-composite: xor;
mask-composite: exclude;
border-right: 0;
}
.tb-41__stub {
-webkit-mask: radial-gradient(.3rem .3rem at 0 50%, #000 96%, transparent 0) 0 -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
mask: radial-gradient(.3rem .3rem at 0 50%, #000 96%, transparent 0) 0 -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
-webkit-mask-composite: xor;
mask-composite: exclude;
}
}
@media (prefers-color-scheme: light) {
.tb-41:not([data-theme="dark"]) {
--color-tb41-bg: oklch(0.3 0.04 235);
}
}
.tb-41[data-theme="light"] {
--color-tb41-bg: oklch(0.3 0.04 235);
}
@media (forced-colors: active) {
.tb-41 button {
mask: none;
-webkit-mask: none;
filter: none;
}
.tb-41__body,
.tb-41__stub {
background: ButtonFace;
border: 1px solid ButtonText;
color: ButtonText;
}
.tb-41__stub span[aria-hidden] {
background: ButtonText;
}
}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-tb41-bg: #0e1b24;
--color-tb41-bg: oklch(0.22 0.03 235);
--color-tb41-card: #fbfbf8;
--color-tb41-card: oklch(0.985 0.004 90);
--color-tb41-card-lo: #eceae2;
--color-tb41-card-lo: oklch(0.93 0.006 90);
--color-tb41-ink: #131a20;
--color-tb41-ink: oklch(0.2 0.015 240);
--color-tb41-muted: #5b646f;
--color-tb41-muted: oklch(0.47 0.015 240);
--color-tb41-brand: #0f5f7a;
--color-tb41-brand: oklch(0.45 0.09 217);
--color-tb41-seam: #131a2047;
--color-tb41-seam: oklch(0.2 0.015 240 / 0.28);
--font-tb41-sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
--ease-tb41-out: cubic-bezier(0.16, 1, 0.3, 1);
}
.tb-41 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: radial-gradient(38rem 24rem at 50% 30%, #16303e, transparent 72%), var(--color-tb41-bg);
}
.tb-41__body,
.tb-41__stub {
background: linear-gradient(170deg, var(--color-tb41-card), var(--color-tb41-card-lo));
}
/* THE PERFORATION. Each piece carries its OWN half of the seam, on its own edge.
Masking the whole button instead leaves the dot column behind in the button's
coordinate space — so once the stub rotates, the holes stop following it and
start slicing its corners. XOR, not intersect: intersect would erase everything
except the .6rem dot column. */
@supports ((mask-composite: exclude) or (-webkit-mask-composite: xor)) {
.tb-41__body {
-webkit-mask: radial-gradient(.3rem .3rem at 100% 50%, #000 96%, transparent 0) 100% -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
mask: radial-gradient(.3rem .3rem at 100% 50%, #000 96%, transparent 0) 100% -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
-webkit-mask-composite: xor;
mask-composite: exclude;
border-right: 0;
}
.tb-41__stub {
-webkit-mask: radial-gradient(.3rem .3rem at 0 50%, #000 96%, transparent 0) 0 -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
mask: radial-gradient(.3rem .3rem at 0 50%, #000 96%, transparent 0) 0 -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
-webkit-mask-composite: xor;
mask-composite: exclude;
}
}
@media (prefers-color-scheme: light) {
.tb-41:not([data-theme="dark"]) {
--color-tb41-bg: oklch(0.3 0.04 235);
}
}
.tb-41[data-theme="light"] {
--color-tb41-bg: oklch(0.3 0.04 235);
}
@media (forced-colors: active) {
.tb-41 button {
mask: none;
-webkit-mask: none;
filter: none;
}
.tb-41__body,
.tb-41__stub {
background: ButtonFace;
border: 1px solid ButtonText;
color: ButtonText;
}
.tb-41__stub span[aria-hidden] {
background: ButtonText;
}
}@import "tailwindcss";
@theme {
--color-tb41-bg: #0e1b24;
--color-tb41-bg: oklch(0.22 0.03 235);
--color-tb41-card: #fbfbf8;
--color-tb41-card: oklch(0.985 0.004 90);
--color-tb41-card-lo: #eceae2;
--color-tb41-card-lo: oklch(0.93 0.006 90);
--color-tb41-ink: #131a20;
--color-tb41-ink: oklch(0.2 0.015 240);
--color-tb41-muted: #5b646f;
--color-tb41-muted: oklch(0.47 0.015 240);
--color-tb41-brand: #0f5f7a;
--color-tb41-brand: oklch(0.45 0.09 217);
--color-tb41-seam: #131a2047;
--color-tb41-seam: oklch(0.2 0.015 240 / 0.28);
--font-tb41-sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
--ease-tb41-out: cubic-bezier(0.16, 1, 0.3, 1);
}
.tb-41 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: radial-gradient(38rem 24rem at 50% 30%, #16303e, transparent 72%), var(--color-tb41-bg);
}
.tb-41__body,
.tb-41__stub {
background: linear-gradient(170deg, var(--color-tb41-card), var(--color-tb41-card-lo));
}
/* THE PERFORATION. Each piece carries its OWN half of the seam, on its own edge.
Masking the whole button instead leaves the dot column behind in the button's
coordinate space — so once the stub rotates, the holes stop following it and
start slicing its corners. XOR, not intersect: intersect would erase everything
except the .6rem dot column. */
@supports ((mask-composite: exclude) or (-webkit-mask-composite: xor)) {
.tb-41__body {
-webkit-mask: radial-gradient(.3rem .3rem at 100% 50%, #000 96%, transparent 0) 100% -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
mask: radial-gradient(.3rem .3rem at 100% 50%, #000 96%, transparent 0) 100% -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
-webkit-mask-composite: xor;
mask-composite: exclude;
border-right: 0;
}
.tb-41__stub {
-webkit-mask: radial-gradient(.3rem .3rem at 0 50%, #000 96%, transparent 0) 0 -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
mask: radial-gradient(.3rem .3rem at 0 50%, #000 96%, transparent 0) 0 -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
-webkit-mask-composite: xor;
mask-composite: exclude;
}
}
@media (prefers-color-scheme: light) {
.tb-41:not([data-theme="dark"]) {
--color-tb41-bg: oklch(0.3 0.04 235);
}
}
.tb-41[data-theme="light"] {
--color-tb41-bg: oklch(0.3 0.04 235);
}
@media (forced-colors: active) {
.tb-41 button {
mask: none;
-webkit-mask: none;
filter: none;
}
.tb-41__body,
.tb-41__stub {
background: ButtonFace;
border: 1px solid ButtonText;
color: ButtonText;
}
.tb-41__stub span[aria-hidden] {
background: ButtonText;
}
}<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=Archivo:wght@500;600;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=Archivo:wght@500;600;700;800&display=swap">What changed in the port
Which parts became utilities, which stayed CSS, and why.
- Utilities: the two-column grid, every piece of type, the barcode gradient, the stub's hinge and tear, the lift, all states. CSS: the two perforation masks inside their
@supportsblock. - The masks stay in CSS for a reason beyond length: they are a matched pair whose offsets must mirror each other exactly (
at 100% 50%/at 0 50%, same tile, same phase). Splitting a mirrored pair across two class lists is how it drifts. origin-lefton the stub is a two-word utility doing load-bearing work — the hinge must be at the seam, and in the CSS original that wastransform-origin:0% 50%fourteen lines from the rotation it governs.- A11y fix from the CSS original:
--muted:#6b7480on the near-white card is ≈4.3:1, and it carries the seat, the meta row and the gate label — the densest real information on the pass. The port darkens it tooklch(0.47 0.015 240)(≈5.2: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 Airline Boarding Pass Button
Source: https://codefronts.com/components/tailwind-css-buttons/tailwind-airline-boarding-pass-button/
A boarding pass with a genuinely perforated seam: a mask punches half-circles down the divide, the stub tears away and rotates on hover, and a barcode is drawn with one repeating gradient. Flight numbers use tabular-nums so nothing shifts as they change.
## HTML
```html
<div class="tb-41 w-full min-h-svh grid place-items-center font-tb41-sans antialiased p-[clamp(1.5rem,6vw,4rem)]">
<button type="button" class="group relative cursor-pointer border-0 p-0 bg-transparent grid grid-cols-[1fr_auto] items-stretch w-[min(100%,30rem)] text-left text-tb41-ink drop-shadow-[0_18px_26px_#0000008c] transition-[translate,filter] duration-[350ms] ease-tb41-out [-webkit-tap-highlight-color:transparent] hover:-translate-y-[3px] hover:drop-shadow-[0_26px_34px_#00000099] focus-visible:-translate-y-[3px] focus-visible:outline-2 focus-visible:outline-offset-[5px] focus-visible:outline-tb41-brand active:translate-y-px disabled:cursor-not-allowed disabled:grayscale-[0.6] motion-reduce:transition-none">
<span class="tb-41__body grid gap-3 px-4.5 pt-4 pb-4.5 rounded-l-[0.6rem] border-r border-dashed border-tb41-seam">
<span class="flex items-baseline justify-between gap-3">
<span class="text-xs font-extrabold tracking-[0.16em] uppercase text-tb41-brand">Meridian Air</span>
<span class="text-[0.6875rem] font-semibold tracking-[0.06em] tabular-nums text-tb41-muted">14A · Zone 2</span>
</span>
<span class="flex items-center gap-3">
<span class="text-3xl font-extrabold tracking-[-0.02em] leading-none">LHR</span>
<svg viewBox="0 0 24 24" aria-hidden="true" fill="currentColor" class="size-5 text-tb41-brand transition-transform duration-500 ease-tb41-out group-hover:translate-x-1.5 group-focus-visible:translate-x-1.5 motion-reduce:transition-none"><path d="M2 13.5 22 9l-1 3.2-6.6 2.2-2.2 5.1-2.1.6 1-5-6.6 2.2L2 13.5z"/></svg>
<span class="text-3xl font-extrabold tracking-[-0.02em] leading-none">JFK</span>
</span>
<span class="flex flex-wrap gap-x-4.5 gap-y-1.5 text-xs tabular-nums text-tb41-muted">
<span>Boards <b class="font-bold text-tb41-ink">18:40</b></span>
<span>Gate <b class="font-bold text-tb41-ink">B22</b></span>
<span>Flt <b class="font-bold text-tb41-ink">MA 214</b></span>
</span>
</span>
<span class="tb-41__stub grid gap-2 justify-items-center content-center px-3.5 py-4 rounded-r-[0.6rem] origin-left transition-[rotate,translate] duration-[450ms] ease-tb41-out group-hover:rotate-[3.5deg] group-hover:translate-x-[0.4rem] group-focus-visible:rotate-[3.5deg] group-focus-visible:translate-x-[0.4rem] motion-reduce:transition-none">
<span class="text-[0.625rem] font-extrabold tracking-[0.14em] uppercase text-center text-tb41-brand">Tap to check in</span>
<span aria-hidden="true" class="block w-18 h-10 bg-[repeating-linear-gradient(90deg,var(--color-tb41-ink)_0_2px,transparent_2px_4px,var(--color-tb41-ink)_4px_5px,transparent_5px_8px,var(--color-tb41-ink)_8px_11px,transparent_11px_12px,var(--color-tb41-ink)_12px_13px,transparent_13px_16px)]"></span>
<span class="text-[0.9375rem] font-extrabold tracking-[0.04em] tabular-nums">14A</span>
</span>
</button>
</div>
```
## CSS
```css
@import "tailwindcss";
@theme {
--color-tb41-bg: #0e1b24;
--color-tb41-bg: oklch(0.22 0.03 235);
--color-tb41-card: #fbfbf8;
--color-tb41-card: oklch(0.985 0.004 90);
--color-tb41-card-lo: #eceae2;
--color-tb41-card-lo: oklch(0.93 0.006 90);
--color-tb41-ink: #131a20;
--color-tb41-ink: oklch(0.2 0.015 240);
--color-tb41-muted: #5b646f;
--color-tb41-muted: oklch(0.47 0.015 240);
--color-tb41-brand: #0f5f7a;
--color-tb41-brand: oklch(0.45 0.09 217);
--color-tb41-seam: #131a2047;
--color-tb41-seam: oklch(0.2 0.015 240 / 0.28);
--font-tb41-sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
--ease-tb41-out: cubic-bezier(0.16, 1, 0.3, 1);
}
.tb-41 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: radial-gradient(38rem 24rem at 50% 30%, #16303e, transparent 72%), var(--color-tb41-bg);
}
.tb-41__body,
.tb-41__stub {
background: linear-gradient(170deg, var(--color-tb41-card), var(--color-tb41-card-lo));
}
/* THE PERFORATION. Each piece carries its OWN half of the seam, on its own edge.
Masking the whole button instead leaves the dot column behind in the button's
coordinate space — so once the stub rotates, the holes stop following it and
start slicing its corners. XOR, not intersect: intersect would erase everything
except the .6rem dot column. */
@supports ((mask-composite: exclude) or (-webkit-mask-composite: xor)) {
.tb-41__body {
-webkit-mask: radial-gradient(.3rem .3rem at 100% 50%, #000 96%, transparent 0) 100% -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
mask: radial-gradient(.3rem .3rem at 100% 50%, #000 96%, transparent 0) 100% -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
-webkit-mask-composite: xor;
mask-composite: exclude;
border-right: 0;
}
.tb-41__stub {
-webkit-mask: radial-gradient(.3rem .3rem at 0 50%, #000 96%, transparent 0) 0 -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
mask: radial-gradient(.3rem .3rem at 0 50%, #000 96%, transparent 0) 0 -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
-webkit-mask-composite: xor;
mask-composite: exclude;
}
}
@media (prefers-color-scheme: light) {
.tb-41:not([data-theme="dark"]) {
--color-tb41-bg: oklch(0.3 0.04 235);
}
}
.tb-41[data-theme="light"] {
--color-tb41-bg: oklch(0.3 0.04 235);
}
@media (forced-colors: active) {
.tb-41 button {
mask: none;
-webkit-mask: none;
filter: none;
}
.tb-41__body,
.tb-41__stub {
background: ButtonFace;
border: 1px solid ButtonText;
color: ButtonText;
}
.tb-41__stub span[aria-hidden] {
background: ButtonText;
}
}
```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 Airline Boarding Pass Button
Source: https://codefronts.com/components/tailwind-css-buttons/tailwind-airline-boarding-pass-button/
A boarding pass with a genuinely perforated seam: a mask punches half-circles down the divide, the stub tears away and rotates on hover, and a barcode is drawn with one repeating gradient. Flight numbers use tabular-nums so nothing shifts as they change.
## HTML
```html
<div class="tb-41 w-full min-h-svh grid place-items-center font-tb41-sans antialiased p-[clamp(1.5rem,6vw,4rem)]">
<button type="button" class="group relative cursor-pointer border-0 p-0 bg-transparent grid grid-cols-[1fr_auto] items-stretch w-[min(100%,30rem)] text-left text-tb41-ink drop-shadow-[0_18px_26px_#0000008c] transition-[translate,filter] duration-[350ms] ease-tb41-out [-webkit-tap-highlight-color:transparent] hover:-translate-y-[3px] hover:drop-shadow-[0_26px_34px_#00000099] focus-visible:-translate-y-[3px] focus-visible:outline-2 focus-visible:outline-offset-[5px] focus-visible:outline-tb41-brand active:translate-y-px disabled:cursor-not-allowed disabled:grayscale-[0.6] motion-reduce:transition-none">
<span class="tb-41__body grid gap-3 px-4.5 pt-4 pb-4.5 rounded-l-[0.6rem] border-r border-dashed border-tb41-seam">
<span class="flex items-baseline justify-between gap-3">
<span class="text-xs font-extrabold tracking-[0.16em] uppercase text-tb41-brand">Meridian Air</span>
<span class="text-[0.6875rem] font-semibold tracking-[0.06em] tabular-nums text-tb41-muted">14A · Zone 2</span>
</span>
<span class="flex items-center gap-3">
<span class="text-3xl font-extrabold tracking-[-0.02em] leading-none">LHR</span>
<svg viewBox="0 0 24 24" aria-hidden="true" fill="currentColor" class="size-5 text-tb41-brand transition-transform duration-500 ease-tb41-out group-hover:translate-x-1.5 group-focus-visible:translate-x-1.5 motion-reduce:transition-none"><path d="M2 13.5 22 9l-1 3.2-6.6 2.2-2.2 5.1-2.1.6 1-5-6.6 2.2L2 13.5z"/></svg>
<span class="text-3xl font-extrabold tracking-[-0.02em] leading-none">JFK</span>
</span>
<span class="flex flex-wrap gap-x-4.5 gap-y-1.5 text-xs tabular-nums text-tb41-muted">
<span>Boards <b class="font-bold text-tb41-ink">18:40</b></span>
<span>Gate <b class="font-bold text-tb41-ink">B22</b></span>
<span>Flt <b class="font-bold text-tb41-ink">MA 214</b></span>
</span>
</span>
<span class="tb-41__stub grid gap-2 justify-items-center content-center px-3.5 py-4 rounded-r-[0.6rem] origin-left transition-[rotate,translate] duration-[450ms] ease-tb41-out group-hover:rotate-[3.5deg] group-hover:translate-x-[0.4rem] group-focus-visible:rotate-[3.5deg] group-focus-visible:translate-x-[0.4rem] motion-reduce:transition-none">
<span class="text-[0.625rem] font-extrabold tracking-[0.14em] uppercase text-center text-tb41-brand">Tap to check in</span>
<span aria-hidden="true" class="block w-18 h-10 bg-[repeating-linear-gradient(90deg,var(--color-tb41-ink)_0_2px,transparent_2px_4px,var(--color-tb41-ink)_4px_5px,transparent_5px_8px,var(--color-tb41-ink)_8px_11px,transparent_11px_12px,var(--color-tb41-ink)_12px_13px,transparent_13px_16px)]"></span>
<span class="text-[0.9375rem] font-extrabold tracking-[0.04em] tabular-nums">14A</span>
</span>
</button>
</div>
```
## CSS
```css
@import "tailwindcss";
@theme {
--color-tb41-bg: #0e1b24;
--color-tb41-bg: oklch(0.22 0.03 235);
--color-tb41-card: #fbfbf8;
--color-tb41-card: oklch(0.985 0.004 90);
--color-tb41-card-lo: #eceae2;
--color-tb41-card-lo: oklch(0.93 0.006 90);
--color-tb41-ink: #131a20;
--color-tb41-ink: oklch(0.2 0.015 240);
--color-tb41-muted: #5b646f;
--color-tb41-muted: oklch(0.47 0.015 240);
--color-tb41-brand: #0f5f7a;
--color-tb41-brand: oklch(0.45 0.09 217);
--color-tb41-seam: #131a2047;
--color-tb41-seam: oklch(0.2 0.015 240 / 0.28);
--font-tb41-sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
--ease-tb41-out: cubic-bezier(0.16, 1, 0.3, 1);
}
.tb-41 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: radial-gradient(38rem 24rem at 50% 30%, #16303e, transparent 72%), var(--color-tb41-bg);
}
.tb-41__body,
.tb-41__stub {
background: linear-gradient(170deg, var(--color-tb41-card), var(--color-tb41-card-lo));
}
/* THE PERFORATION. Each piece carries its OWN half of the seam, on its own edge.
Masking the whole button instead leaves the dot column behind in the button's
coordinate space — so once the stub rotates, the holes stop following it and
start slicing its corners. XOR, not intersect: intersect would erase everything
except the .6rem dot column. */
@supports ((mask-composite: exclude) or (-webkit-mask-composite: xor)) {
.tb-41__body {
-webkit-mask: radial-gradient(.3rem .3rem at 100% 50%, #000 96%, transparent 0) 100% -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
mask: radial-gradient(.3rem .3rem at 100% 50%, #000 96%, transparent 0) 100% -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
-webkit-mask-composite: xor;
mask-composite: exclude;
border-right: 0;
}
.tb-41__stub {
-webkit-mask: radial-gradient(.3rem .3rem at 0 50%, #000 96%, transparent 0) 0 -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
mask: radial-gradient(.3rem .3rem at 0 50%, #000 96%, transparent 0) 0 -.475rem/.6rem .95rem repeat-y, linear-gradient(#000, #000);
-webkit-mask-composite: xor;
mask-composite: exclude;
}
}
@media (prefers-color-scheme: light) {
.tb-41:not([data-theme="dark"]) {
--color-tb41-bg: oklch(0.3 0.04 235);
}
}
.tb-41[data-theme="light"] {
--color-tb41-bg: oklch(0.3 0.04 235);
}
@media (forced-colors: active) {
.tb-41 button {
mask: none;
-webkit-mask: none;
filter: none;
}
.tb-41__body,
.tb-41__stub {
background: ButtonFace;
border: 1px solid ButtonText;
color: ButtonText;
}
.tb-41__stub span[aria-hidden] {
background: ButtonText;
}
}
```How this works
The perforation must live on each piece, not on the button. This is the demo's real lesson, and the port keeps it in a CSS comment where it will be read:
.tb-41__body { mask: radial-gradient(… at 100% 50% …) 100% -.475rem/.6rem .95rem repeat-y,
linear-gradient(#000,#000); mask-composite: exclude; }
.tb-41__stub { mask: radial-gradient(… at 0 50% …) 0 -.475rem/.6rem .95rem repeat-y,
linear-gradient(#000,#000); mask-composite: exclude; }Masking the whole button leaves the dot column fixed in the button's coordinate space — the moment the stub rotates, the holes stop following it and start slicing its corners. And intersect instead of exclude would erase everything except the 0.6rem dot column.
Everything else ports cleanly: the two-column grid, the band, the route type, the barcode, the hinge, the lift. The pass is real text throughout — flight data in a button must stay readable, never become an image.
Make it yours
- Move the seam by changing the stub's width; both perforation columns anchor to their own piece's edge, so nothing else updates.
- Perforation pitch is the mask tile height (
.95rem) — tighter reads as thinner card stock. --color-tb41-brandrecolours the airline band; the pass body stays neutral so any brand fits.- Swap the barcode for a QR placeholder (a checkerboard conic) if your product scans codes.
- The tear is a hover affordance only — a click must act, not destroy.
Gotchas — read before shipping
mask-compositekeywords differ between prefixed and standard (xorvsexclude). Declare both, and choose XOR whenever a layer covers only part of the element.- Put the mask on the piece that moves. A mask resolves in the masked element's own box, so a transformed descendant slides out from under it.
- Flight data must stay text. Never an image for looks.
tabular-numsonly works if the font ships the feature — the fallback stack matters.- Masks clip outlines drawn inside the box. Keep the ring on
outline-*with an offset.
Browser support
| Chrome | Safari | Firefox | Edge |
|---|---|---|---|
| 120+ | 16.4+ | 128+ | 120+ |
mask + mask-composite need Chrome 120 / Safari 15.4 / Firefox 53; the @supports block keeps a dashed seam as the fallback, and the pass still works.