Code Reference

Custom Config

Tailwind · Reference cheat sheet

Custom Config

Tailwind · Reference cheat sheet


📋 Overview

Customize Tailwind via theme.extend (preserve defaults) or replace theme keys. Content paths, plugins, and dark mode strategy live in the same config (v3) or CSS-first config (v4).

🔧 Core concepts

KeyPurpose
contentFiles to scan for classes
theme.extendAdd tokens without wiping defaults
theme (replace)Override entire scales
pluginsRegister official/community plugins
prefixNamespace classes (tw-)
corePluginsDisable built-ins
Extend examplesAdds
colors.brandBrand palette
fontFamily.displayCustom font stack
spacing['18']Extra spacing step
screens.3xlExtra breakpoint

💡 Examples

Extend theme (v3):

export default {
  content: ["./src/**/*.{js,ts,jsx,tsx}"],
  theme: {
    extend: {
      colors: {
        brand: { DEFAULT: "#0F766E", light: "#5EEAD4" },
      },
      fontFamily: {
        display: ["\"Fraunces\"", "serif"],
      },
    },
  },
};

Use tokens:

<h1 class="font-display text-brand">Hello</h1>

Prefix:

export default { prefix: "tw-", content: ["./src/**/*.{html,js}"] };
// classes become tw-flex, tw-p-4, ...

⚠️ Pitfalls

  • Replacing theme.colors entirely removes the default palette — use extend.
  • Wrong content globs silently drop utilities.
  • Arbitrary values don't need config — but shared brand tokens should be themed.

On this page