51 Tailwind CSS Buttons
03 / 51

All 51 in 51 Tailwind CSS Buttons

  1. 01Tailwind Submit Button (Form Primary)
  2. 02Tailwind Primary and Secondary Button Pair
  3. 03Tailwind Ghost / Outline Button
  4. 04Tailwind Icon-Only Button with Accessible Tooltip
  5. 05Tailwind Gradient CTA Button
  6. 06Tailwind Loading Spinner Button (State Transition)
  7. 07Tailwind Disabled Button State (Full State Reference)
  8. 08Tailwind Button Group Component (Segmented Radio-Like)
  9. 09Tailwind Add to Cart Button
  10. 10Tailwind Download Progress Button
  11. 11Tailwind Like Heart Button
  12. 12Tailwind Confirm Delete Button
  13. 13Tailwind Play Pause Button
  14. 14Tailwind Subscribe Confetti Button
  15. 15Tailwind Magnetic Mercury Ripple Button
  16. 16Tailwind Brutalist Glitch Button
  17. 17Tailwind Neon Plasma Burst Button
  18. 18Tailwind Clay Press Button
  19. 19Tailwind Editorial Ink Spread Button
  20. 20Tailwind Particle Shard Burst Button
  21. 21Tailwind Brushed Brass Plate Button
  22. 22Tailwind Washi Paper Crane Button
  23. 23Tailwind Frosted Ice Cube Button
  24. 24Tailwind Vintage Typewriter Key Button
  25. 25Tailwind Lacquered Walnut Wood Button
  26. 26Tailwind Pharma Gel Capsule Button
  27. 27Tailwind Aged Copper Coin Button
  28. 28Tailwind Origami Fortune Cookie Button
  29. 29Tailwind Holographic Foil Sticker Button
  30. 30Tailwind Brutalist Concrete Slab Button
  31. 31Tailwind Mercury Bead Morph Button
  32. 32Tailwind Soft Pill Modern SaaS Button
  33. 33Tailwind Masking Tape Label Button
  34. 34Tailwind Obsidian Glass Shard Button
  35. 35Tailwind Wine Velvet Ribbon Button
  36. 36Tailwind LED Segment Display Button
  37. 37Tailwind Cassette Mixtape Label Button
  38. 38Tailwind Chalkboard Menu Button
  39. 39Tailwind Vinyl Record Sleeve Ripple Button
  40. 40Tailwind Polaroid Snapshot Button
  41. 41Tailwind Airline Boarding Pass Button
  42. 42Tailwind Aged Brass Subway Token Button
  43. 43Tailwind Vintage Rx Pharmacy Label Button
  44. 44Tailwind Bakelite Radio Dial Toggle Button
  45. 45Tailwind Regal Postage Stamp Button
  46. 46Tailwind Victorian Cigar Band Foil Button
  47. 47Tailwind Vintage Calculator Key Button
  48. 48Tailwind Toolbox Latch Spotlight Button
  49. 49Tailwind Receipt Paper Total Count-Up Button
  50. 50Tailwind IBM Punch Card Magnetic Follow Button
  51. 51Tailwind Brass Periscope Lens Button
Pure TailwindMIT licensed

Tailwind Ghost / Outline Button

A ghost button that keeps its 1px silhouette at rest and fills from the bottom edge on hover, the label inverting in the same beat. The fill is one background-size transition on a fixed gradient — no pseudo-element, no overflow clipping — and the border is currentColor, so one colour utility re-skins the whole control.

Live Demo
Plain CSSTailwind v4
Try it

Untitled UI Pro: 5,000+ React + Tailwind CSS v4 components · from $349 one-time

Untitled UI React · Affiliate link

Get Untitled UI Pro

The code

<div class="tb-03 w-full min-h-svh grid place-items-center bg-tb03-bg font-tb03-sans antialiased p-[clamp(1.5rem,6vw,4rem)]">
  <button type="button" class="group cursor-pointer inline-grid grid-flow-col items-center gap-2.5 min-h-13 px-7 border border-current rounded-full text-[0.9375rem] font-medium tracking-[0.01em] text-tb03-accent bg-transparent bg-[linear-gradient(var(--color-tb03-accent),var(--color-tb03-accent))] bg-no-repeat bg-bottom bg-[length:100%_0%] transition-[background-size,color,letter-spacing] duration-[420ms] ease-tb03-out [transition-delay:0ms,60ms,0ms] hover:bg-[length:100%_100%] hover:text-tb03-on-accent hover:tracking-[0.03em] focus-visible:bg-[length:100%_100%] focus-visible:text-tb03-on-accent focus-visible:tracking-[0.03em] focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-tb03-accent active:scale-[0.985] disabled:cursor-not-allowed disabled:opacity-40 disabled:bg-[length:100%_0%] motion-reduce:transition-[color,background-size] motion-reduce:duration-100 motion-reduce:hover:tracking-[0.01em]">
    <span>Read the case study</span>
    <svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" class="w-[1.05rem] h-[1.05rem] transition-transform duration-[420ms] ease-tb03-out group-hover:rotate-45 group-focus-visible:rotate-45 motion-reduce:transition-none motion-reduce:group-hover:rotate-0"><path d="M7 17 17 7"/><path d="M8.5 7H17v8.5"/></svg>
  </button>
</div>
@import "tailwindcss";

@theme {
  --color-tb03-bg: #faf9f6;
  --color-tb03-bg: oklch(0.978 0.006 95);
  --color-tb03-accent: #111827;
  --color-tb03-accent: oklch(0.22 0.02 265);
  --color-tb03-on-accent: #f9fafb;
  --color-tb03-on-accent: oklch(0.98 0.003 265);
  --font-tb03-sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-tb03-out: cubic-bezier(0.16, 1, 0.3, 1);
}

.tb-03 {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
}

@media (prefers-color-scheme: dark) {
  .tb-03:not([data-theme="light"]) {
    --color-tb03-bg: oklch(0.14 0.004 265);
    --color-tb03-accent: oklch(0.96 0.004 95);
    --color-tb03-on-accent: oklch(0.16 0.006 265);
  }
}

.tb-03[data-theme="dark"] {
  --color-tb03-bg: oklch(0.14 0.004 265);
  --color-tb03-accent: oklch(0.96 0.004 95);
  --color-tb03-on-accent: oklch(0.16 0.006 265);
}

@media (forced-colors: active) {
  .tb-03 button {
    background: none;
    border-color: ButtonText;
    color: ButtonText;
  }

  .tb-03 button:hover {
    background: Highlight;
    color: HighlightText;
  }
}

Setup — do this once per project

Skip this if your project already runs Tailwind v4.

1Load Tailwind
<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.

2Add the stylesheetRequiredthe @theme block is what makes the custom utilities exist
@import "tailwindcss";

@theme {
  --color-tb03-bg: #faf9f6;
  --color-tb03-bg: oklch(0.978 0.006 95);
  --color-tb03-accent: #111827;
  --color-tb03-accent: oklch(0.22 0.02 265);
  --color-tb03-on-accent: #f9fafb;
  --color-tb03-on-accent: oklch(0.98 0.003 265);
  --font-tb03-sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-tb03-out: cubic-bezier(0.16, 1, 0.3, 1);
}

.tb-03 {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
}

@media (prefers-color-scheme: dark) {
  .tb-03:not([data-theme="light"]) {
    --color-tb03-bg: oklch(0.14 0.004 265);
    --color-tb03-accent: oklch(0.96 0.004 95);
    --color-tb03-on-accent: oklch(0.16 0.006 265);
  }
}

.tb-03[data-theme="dark"] {
  --color-tb03-bg: oklch(0.14 0.004 265);
  --color-tb03-accent: oklch(0.96 0.004 95);
  --color-tb03-on-accent: oklch(0.16 0.006 265);
}

@media (forced-colors: active) {
  .tb-03 button {
    background: none;
    border-color: ButtonText;
    color: ButtonText;
  }

  .tb-03 button:hover {
    background: Highlight;
    color: HighlightText;
  }
}
3Fonts used by this demooptional — skip if you have your own type stack
<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=Space+Grotesk:wght@400;500;600;700&display=swap">

What changed in the port

Which parts became utilities, which stayed CSS, and why.

  • Utilities: the entire effect — gradient, background position, both background sizes, the colour flip, the tracking shift and the arrow rotation. This is the demo where the port is a straight win: five CSS rules collapse into one class list with no loss.
  • CSS: the dark block and forced-colors only.
  • The per-property delay had to be an arbitrary property ([transition-delay:0ms,60ms,0ms]) because delay-* applies to all transitioned properties at once. It is the only stagger in the collection that needs this, and it is worth the escape hatch — remove it and the label disappears for 80ms on every hover.
  • group-focus-visible: on the arrow is new: the CSS original rotated the arrow with :is(:hover,:focus-visible) on the button, and the group variant is the exact equivalent.
Paste this into ChatGPT, Claude, Cursor, or any coding assistant. The block below is pre-framed with everything the AI needs to integrate this demo into your project — markup, styles, scoping notes, and the source URL. Hit Copy and paste straight into your chat.
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 Ghost / Outline Button
Source: https://codefronts.com/components/tailwind-css-buttons/tailwind-ghost-outline-button/

A ghost button that keeps its 1px silhouette at rest and fills from the bottom edge on hover, the label inverting in the same beat. The fill is one background-size transition on a fixed gradient — no pseudo-element, no overflow clipping — and the border is currentColor, so one colour utility re-skins the whole control.
## HTML
```html
<div class="tb-03 w-full min-h-svh grid place-items-center bg-tb03-bg font-tb03-sans antialiased p-[clamp(1.5rem,6vw,4rem)]">
  <button type="button" class="group cursor-pointer inline-grid grid-flow-col items-center gap-2.5 min-h-13 px-7 border border-current rounded-full text-[0.9375rem] font-medium tracking-[0.01em] text-tb03-accent bg-transparent bg-[linear-gradient(var(--color-tb03-accent),var(--color-tb03-accent))] bg-no-repeat bg-bottom bg-[length:100%_0%] transition-[background-size,color,letter-spacing] duration-[420ms] ease-tb03-out [transition-delay:0ms,60ms,0ms] hover:bg-[length:100%_100%] hover:text-tb03-on-accent hover:tracking-[0.03em] focus-visible:bg-[length:100%_100%] focus-visible:text-tb03-on-accent focus-visible:tracking-[0.03em] focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-tb03-accent active:scale-[0.985] disabled:cursor-not-allowed disabled:opacity-40 disabled:bg-[length:100%_0%] motion-reduce:transition-[color,background-size] motion-reduce:duration-100 motion-reduce:hover:tracking-[0.01em]">
    <span>Read the case study</span>
    <svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" class="w-[1.05rem] h-[1.05rem] transition-transform duration-[420ms] ease-tb03-out group-hover:rotate-45 group-focus-visible:rotate-45 motion-reduce:transition-none motion-reduce:group-hover:rotate-0"><path d="M7 17 17 7"/><path d="M8.5 7H17v8.5"/></svg>
  </button>
</div>
```
## CSS
```css
@import "tailwindcss";

@theme {
  --color-tb03-bg: #faf9f6;
  --color-tb03-bg: oklch(0.978 0.006 95);
  --color-tb03-accent: #111827;
  --color-tb03-accent: oklch(0.22 0.02 265);
  --color-tb03-on-accent: #f9fafb;
  --color-tb03-on-accent: oklch(0.98 0.003 265);
  --font-tb03-sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-tb03-out: cubic-bezier(0.16, 1, 0.3, 1);
}

.tb-03 {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
}

@media (prefers-color-scheme: dark) {
  .tb-03:not([data-theme="light"]) {
    --color-tb03-bg: oklch(0.14 0.004 265);
    --color-tb03-accent: oklch(0.96 0.004 95);
    --color-tb03-on-accent: oklch(0.16 0.006 265);
  }
}

.tb-03[data-theme="dark"] {
  --color-tb03-bg: oklch(0.14 0.004 265);
  --color-tb03-accent: oklch(0.96 0.004 95);
  --color-tb03-on-accent: oklch(0.16 0.006 265);
}

@media (forced-colors: active) {
  .tb-03 button {
    background: none;
    border-color: ButtonText;
    color: ButtonText;
  }

  .tb-03 button:hover {
    background: Highlight;
    color: HighlightText;
  }
}
```

How this works

The fill animates background-size, not a layer. That keeps it perfectly clipped to the border radius for free, and Tailwind expresses it in arbitrary length values:

class="bg-no-repeat bg-bottom bg-[length:100%_0%]
  hover:bg-[length:100%_100%] focus-visible:bg-[length:100%_100%]"

The staggered delay is the detail. The label's colour flips 60ms after the fill starts, so the text is never the same lightness as the rising edge. In v4 that is a per-property delay inside the transition shorthand, which is why this demo writes transition-[…] and [transition-delay:0ms,60ms,0ms] rather than duration-* utilities.

Every hover has its focus-visible twin, written out in full — five pairs on one element. Verbose, and the verbosity is the point: a keyboard user gets the identical animation, and you can see that they do.

Make it yours

  • Fill direction is one utility: bg-left wipes across, bg-top drops down.
  • border-2 for a bolder editorial ghost; padding is in rem, so the height doesn't shift.
  • border-dashed for an "add item" placeholder.
  • Dense UI: swap the duration-[420ms] for duration-200 — the long curve suits marketing pages.
  • rounded-full → rounded-lg for a squarer, more technical read.

Gotchas — read before shipping

  • Ghost buttons fail contrast easily: the label needs 4.5:1 against the page and the 1px border needs 3:1 as a non-text element. A light grey outline on white passes neither.
  • Percentage background-size needs both axes explicit — bg-[length:100%_0%], never bg-[length:0%], or Safari refuses to interpolate.
  • Users read ghost buttons as disabled next to a filled primary. Pair them with clear verbs.
  • The underscore in bg-[length:100%_0%] is Tailwind's space escape. A literal space breaks the class name and the utility silently never generates.
  • Don't switch to a pseudo-element fill and reach for overflow-hidden — it would clip the focus outline. The background-size approach has no such problem.

Browser support

ChromeSafariFirefoxEdge
111+16.4+128+111+

background-size transitions and currentColor borders are supported everywhere relevant; the floor quoted is Tailwind v4's generated sheet.

Techniques used in this demo

Search CodeFronts

Loading…