Skip to main content

Overview

Tailwind CSS v4 provides TypeScript-first configuration types for defining themes, plugins, and content sources. The configuration system supports both user-provided configs and fully resolved configs.

UserConfig

The UserConfig interface defines the structure for user-provided configuration.

Properties

UserConfig[]
Array of preset configurations to extend. Presets are merged in order, with later configs taking precedence.
ThemeConfig
Theme configuration for customizing design tokens.
Plugin[]
Array of plugins to extend Tailwind’s functionality.
ContentFile[] | ContentConfig
Content source configuration for scanning template files.Can be either:
  • Simple array of file patterns or raw content
  • Object with relative flag and files array
DarkModeStrategy
Strategy for handling dark mode variants.Options:
  • false - Disable dark mode
  • 'media' - Use prefers-color-scheme media query
  • 'class' - Require .dark class on HTML element
  • ['class', '.dark-theme'] - Custom dark mode class
  • 'selector' - Use :where(.dark) selector
  • ['selector', '[data-theme="dark"]'] - Custom selector
  • ['variant', '&:is(.dark *)'] - Fully custom variant
string
Prefix to add to all utility class names.
string[]
Array of class names to exclude from generation.
boolean | string
Make all utilities !important or scope them to a selector.
'all' | Record<string, boolean>
Enable future opt-in features.
'all' | Record<string, boolean>
Enable experimental features.

ResolvedConfig

The ResolvedConfig interface represents a fully processed configuration after merging presets and resolving all values.

Properties

Record<string, Record<string, unknown>>
Fully resolved theme with all presets merged and functions evaluated.
PluginWithConfig[]
Array of resolved plugins with their configuration.
ResolvedContentConfig
Resolved content configuration.
DarkModeStrategy | null
Resolved dark mode strategy, or null if disabled.
string
Resolved prefix (empty string if none).
string[]
Resolved blocklist (empty array if none).
boolean | string
Resolved important setting.
Record<string, boolean>
Resolved future flags.
Record<string, boolean>
Resolved experimental flags.

ThemeConfig

Detailed structure for theme configuration.

Theme Values

Theme values can be:
  1. Static objects - Direct key-value pairs
  2. Functions - Receive PluginUtils and return values
  3. null/undefined - Disable a theme section

Content Configuration

Detailed content source configuration options.

ContentFile Types

Complete Configuration Example

Type Exports

v3 Compatibility Exports

For backwards compatibility with Tailwind CSS v3, the following exports are available:

Colors

Access the default color palette:

Default Theme

Access default theme values for use in JavaScript configs:

Flatten Color Palette

Utility function to flatten nested color objects:
These exports are provided for v3 compatibility. In v4, prefer using the CSS-based theme system with @theme directive and theme variables.