Tailwind Config Generator

Generates a valid tailwind.config.ts from content globs, custom theme.extend colors and font families, a dark mode strategy (class/media/selector), and toggles for the official typography, forms, and aspect-ratio plugins, as real typed TypeScript using satisfies Config. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-26

Overview

Introduction

A tailwind.config.ts usually needs the same handful of customizations early on, correct content globs so the class scanner actually finds your markup, a couple of brand colors and font families, and maybe an official plugin, each with its own small syntax to get right.

This tool generates a typed tailwind.config.ts covering all of that from a simple form, ready to save at the project root.

What Is Tailwind Config Generator?

A tailwind.config.ts generator covering content globs, theme.extend colors and fontFamily entries, a dark mode strategy, and the three official Tailwind plugins (typography, forms, aspect-ratio).

The output is real, typed TypeScript using Tailwind's `Config` type and the `satisfies` operator, matching the config format Tailwind's own documentation recommends for TypeScript projects.

How Tailwind Config Generator Works

Content globs, colors, and fonts you enter are placed directly into the `content` array and `theme.extend.colors`/`theme.extend.fontFamily` objects respectively, with empty color/font rows filtered out before generation.

Each enabled plugin gets both an import statement (from its actual npm package name) and an entry in the `plugins` array, and the whole file is wrapped in `export default { ... } satisfies Config`.

When To Use Tailwind Config Generator

Use it when adding Tailwind to a new project and you already know your content paths, a few brand colors/fonts, and whether you want class-based or media-based dark mode.

It's also useful for quickly producing the plugin-import boilerplate when adding the typography or forms plugin to an existing Tailwind setup.

Features

Advantages

  • Produces correctly typed TypeScript config using Tailwind's own recommended `satisfies Config` pattern, catching config typos at compile time.
  • Only includes theme.extend blocks and plugin imports for values you actually filled in, avoiding empty `colors: {}`/`fontFamily: {}` clutter.
  • Covers all three official first-party Tailwind plugins with correct import names, avoiding a common mismatch between plugin package name and its exported function name.

Limitations

  • Doesn't validate that your content globs actually match real files in your project; an overly narrow glob will still produce a config that silently misses styles.
  • Covers theme.extend colors/fonts only; other theme customizations (spacing scale, breakpoints, custom utilities) need manual additions beyond this output.

Examples

Class-based dark mode with a brand color and the typography plugin

Input

content: ["./src/**/*.{ts,tsx}"], darkMode: class, colors: {brand: "#4f46e5"}, plugins: [typography]

Output

import type { Config } from "tailwindcss";
import typography from "@tailwindcss/typography";

export default {
  darkMode: "class",
  content: [
    "./src/**/*.{ts,tsx}",
  ],
  theme: {
    extend: {
      colors: {
        brand: "#4f46e5",
      },
    },
  },
  plugins: [typography],
} satisfies Config;

Best Practices & Notes

Best Practices

  • Include every file type and folder that actually contains class names in `content` (including any shared UI package outside your main src folder), since Tailwind's scanner only sees what these globs match.
  • Prefer "class" dark mode over "media" for any app offering a manual light/dark toggle, since "media" alone can't be overridden by user preference within the app.
  • Name custom theme colors semantically (brand, accent, surface) rather than by raw hue, so usage stays meaningful if the actual color value changes later.

Developer Notes

Colors and font families are written as plain object literals under `theme.extend` rather than replacing `theme.colors`/`theme.fontFamily` outright, preserving Tailwind's full default palette and font stack alongside your additions, which is the officially recommended way to add rather than replace defaults. Official plugins are imported by their real package names (@tailwindcss/typography, @tailwindcss/forms, @tailwindcss/aspect-ratio) and referenced by a sanitized identifier (hyphens replaced with underscores) since aspect-ratio's package name isn't a valid bare JS identifier.

Tailwind Config Generator Use Cases

  • Bootstrapping tailwind.config.ts for a new project with brand colors and fonts already decided
  • Adding the typography or forms plugin to style rendered Markdown or form elements
  • Switching a project between class-based and media-based dark mode strategies

Common Mistakes

  • Writing a content glob that misses a folder (like a shared components package outside src/) so Tailwind never scans those files and their classes get purged from production CSS.
  • Replacing `theme.colors` entirely instead of extending it under `theme.extend.colors`, accidentally losing Tailwind's entire default color palette.

Tips

  • Use the Vite Config Generator or Next.js Config Generator next, since Tailwind needs to be wired into the build pipeline as a PostCSS plugin alongside this config.

References

Frequently Asked Questions