Skip to content
Agents tracked: 440 Downloads (7d): 202M down 19.5% GitHub stars: 10.4M Releases (7d): 607 Agent status: 1 with issuesSince last limit reset: Claude 28d · Codex 0d Updated Oct 21, 2026

Tailwind Merge Examples You Can Edit and Run

5 small Tailwind Merge examples written by AgentGid from the official docs, one feature each. Every one runs in your browser: change the code and see the result at once, or describe a change and let AI rewrite it. The screenshots are taken from the same code by our server, which also checks that each example starts without errors.

Tailwind Merge: usage and stats 1,166 AI-built projects use it

Try them all in one place

import { twMerge } from "tailwind-merge";

// Later classes win when they set the same CSS property
const CASES = [
  ["px-2 py-1 bg-red hover:bg-dark-red", "p-3 bg-[#B91C1C]"],
  ["p-4 text-sm", "p-2"],
  ["text-red-500 font-bold", "text-blue-600"],
  ["mt-2 mb-2 rounded", "my-6"],
  ["rounded-lg shadow-sm", "rounded-none"],
];

export default function App() {
  return (
    <div style={page}>
      <div style={card}>
        <div style={{ color: "#a5b4fc", marginBottom: 12 }}>// twMerge(base, override)</div>
        {CASES.map(([base, extra]) => (
          <div key={base} style={{ marginBottom: 10 }}>
            <div style={{ color: "#9ca3af" }}>twMerge("{base}", "{extra}")</div>
            <div style={{ color: "#4ade80" }}>→ "{twMerge(base, extra)}"</div>
          </div>
        ))}
      </div>
    </div>
  );
}
const page = { minHeight: "100vh", display: "flex", alignItems: "center", justifyContent: "center", background: "#111", fontFamily: "ui-monospace, Menlo, monospace" };
const card = { width: 540, padding: 20, borderRadius: 12, background: "#1b1b1f", border: "1px solid #2e2e35", color: "#e5e7eb", fontSize: 13 };
Ctrl/⌘ + Enter runs

Free for signed-in members, with a daily limit. Describe the change in plain words; the new code runs only in your browser.

Each green line is the live output of twMerge; change a class in CASES to see a different merge. Code written by AgentGid [1]. How it works, with a screenshot →

Checked Oct 12, 2026: each example starts without errors in Chromium with tailwind-merge 3.7.0, react 19.3.0, react-dom 19.3.0. Needs WebGL.

Sources

  1. Tailwind Merge README (GitHub)
  2. Docs: dcastil › tailwind-merge › blob › tailwind-merge@3.7.0 › packages › tailwind-mer
  3. Docs: dcastil › tailwind-merge › blob › tailwind-merge@3.7.0 › packages › tailwind-mer

Explanations written by AgentGid from the official docs; the numbers in brackets point here. The code marked "written by AgentGid" is ours and free to copy.

Building something with Tailwind Merge? Ask AgentGid →