@theme in CSS. The configuration file allows you to define content sources, plugins, presets, and more.
Basic Configuration
Create atailwind.config.js or tailwind.config.ts file in your project root:
tailwind.config.ts
Configuration Options
Content
Define which files Tailwind should scan for class names:Dark Mode
Configure how dark mode is handled:Controls dark mode implementation strategyStrategies:
false- No dark mode support'media'- Use@media (prefers-color-scheme: dark)'class'- Requires.darkclass onhtmlelement['class', string]- Custom class name'selector'- Likeclassbut uses:where()for specificity control['selector', string]- Custom selector['variant', string | string[]]- Complete custom control
Prefix
Add a prefix to all utility classes:tw-flex, tw-pt-4, etc.
Prefix to add to all generated utility classes
Important
Make all utilities!important or scope them to a selector:
Add
!important to all utilities or scope to a selectorBlocklist
Prevent specific utilities from being generated:Array of utility names to exclude from generation
Presets
Extend or override configuration from another config:Presets are processed first, and each subsequent config can override values from previous ones. The preset system allows for shareable configuration packages.
TypeScript Support
The config file has full TypeScript support:tailwind.config.ts
Complete Example
tailwind.config.ts