This module comes with a default Tailwind configuration file to provide the best possible user experience.

Default configuration

export default {
  theme: {},
  plugins: [],
  content: [

You can learn more about the Tailwind configuration and the content configuration in Tailwind docs.

Overwriting the configuration

You can extend the default configuration:

The tailwind.config file and config options are subject to the merging strategy.


If a tailwind.config file is present, it will be imported and used to overwrite the default configuration. All of the following file extensions will work by default: .js, .cjs, .mjs, and .ts. When not using the .cjs file extension, you need to use ESM syntax (see #549).

You can configure the path with the configPath option.

This config has the highest priority to overwrite the defaults and tailwindcss.config.
import colors from 'tailwindcss/colors'

export default {
  theme: {
    extend: {
      colors: {
        primary: colors.green

Learn more about the Tailwind config in their docs.

config option

You can also use your nuxt.config file to set your Tailwind config with the tailwindcss.config property:

import tailwindTypography from '@tailwindcss/typography'

export default {
  // ...
  tailwindcss: {
    config: {
      plugins: [tailwindTypography]
This config has less priority over the tailwind.config.js file.


This is an advanced usage section and intended primarily for Nuxt modules authors.


Passes any Tailwind configuration read by the module for each (extended) layer/path before merging all of them.


Passes the resolved vanilla configuration read from all layers and paths with merging using defu.


Passes the complete resolved configuration with all defaults from the full Tailwind config using resolveConfig.


You can use a Nuxt hook to manipulate the Tailwind configuration.

// ~/modules/nuxt-tailwind-mod/index.ts
import { defineNuxtModule, addTemplate } from '@nuxt/kit'

export default defineNuxtModule({
  setup (options, nuxt) {
    nuxt.hook('tailwindcss:config', function (tailwindConfig) {
      tailwindConfig.theme.colors.blue = '#fff'

    nuxt.hook('tailwindcss:resolvedConfig', function (resolvedConfig) {
      console.log('This is the resulting config', JSON.stringify(resolvedConfig))

Learn more about Nuxt modules.

These hooks can be asynchronous (using async/await) and are called after merging the configurations.

Merging strategy

The provided config will be merged using defu's array function merger.

When assigning an array to the content property, it will be concatenated with the default value.


export default {
  content: [

The content option will be:


If you want to fully overwrite its value, you can use a function that receives the default value:

import type { ModuleOptions } from '@nuxtjs/tailwindcss'

const config: ModuleOptions['config'] = {
  content (contentDefaults) {
    return [
      // add the defaults

      // or filter only vue file patterns from defaults
      ...contentDefaults.filter((c) => c.endsWith('*.vue')),

      // add js and vue files for a directory

      // exclude test files if you keep them together with source
        c => c.endsWith('/**/*.{vue,js,ts}')
        c => c.replace('/**/*.{vue,js,ts}', '/**/!(*.{test,spec,story}).{vue,js,ts}')

export default config
This merging strategy of with a function only applies to plugins and content since the default value is defined as an Array.

Safelisting classes

If you need to safelist classes and avoid the content purging system, you need to specify the safelist option:

module.exports = {
  // Safelisting some classes to avoid content purge
  safelist: [
      pattern: /bg-(red|green|blue)-(100|200|300)/,

Referencing in the application

It can often be useful to reference Tailwind configuration values at runtime, e.g. to access some of your theme values when dynamically applying inline styles in a component.

If you need resolved Tailwind config at runtime, you can enable the exposeConfig option:

export default {
  tailwindcss: {
    exposeConfig: true

Then, import where needed from #tailwind-config:

// Import fully resolved config
import tailwindConfig from '#tailwind-config'

// Import only part which is required to allow tree-shaking
import { theme } from '#tailwind-config'

Please be aware this adds ~19.5KB (~3.5KB) to the client bundle size. If you want to only import really specific parts of your tailwind config, you can enable imports for each property in the config:

export default {
  tailwindcss: {
    exposeConfig: {
      level: 4,
      alias: '#twcss' // if you want to change alias
// Import within properties for further tree-shaking
import screens from '#twcss/theme/screens'  // default import
import { _neutral } from '#twcss/theme/colors'  // named (with _ prefix)
import { _800 as slate800 } from '#twcss/theme/colors/slate'  // alias
It is unlikely for level to ever be over 4 - the usual depth of a Tailwind config. A higher value is also likely to increase boot-time and disk space in dev. Refer to the Nuxt Virtual File System to see generated files.
Named exports for properties below root options are prefixed with _ (_colors, _900, _2xl) to ensure safe variable names. You can use default imports to provide any identifier or rename named imports using as. Properties with unsafe variable names (spacing['1.5'], height['1/2'], keyframes.ping['75%, 100%']) do not get exported individually.