Theme Configuration

    Customizing the default theme for your project.

    The section of your tailwind.config.js file is where you define your project’s color palette, type scale, fonts, breakpoints, border radius values, and more.

    tailwind.config.js

    We provide a sensible default theme with a very generous set of values to get you started, but don’t be afraid to change it or extend it; you’re encouraged to customize it as much as you need to fit the goals of your design.


    The theme object contains keys for screens, colors, and spacing, as well as a key for each customizable core plugin.

    See the or the default theme for a complete list of theme options.

    The screens key allows you to customize the responsive breakpoints in your project.

    tailwind.config.js

    1. module.exports = {
    2. theme: {
    3. screens: {
    4. 'sm': '640px',
    5. 'md': '768px',
    6. 'lg': '1024px',
    7. 'xl': '1280px',
    8. '2xl': '1536px',
    9. }
    10. }
    11. }

    To learn more, see the breakpoint customization documentation.

    Colors

    The colors key allows you to customize the global color palette for your project.

    tailwind.config.js

    1. module.exports = {
    2. theme: {
    3. colors: {
    4. transparent: 'transparent',
    5. black: '#000',
    6. white: '#fff',
    7. gray: {
    8. 100: '#f7fafc',
    9. // ...
    10. 900: '#1a202c',
    11. },
    12. // ...
    13. }
    14. }
    15. }

    By default, these colors are inherited by all color-related core plugins, like backgroundColor, borderColor, textColor, and others.

    To learn more, see the color customization documentation.

    Spacing

    The spacing key allows you to customize the global spacing and sizing scale for your project.

    tailwind.config.js

    1. module.exports = {
    2. theme: {
    3. spacing: {
    4. px: '1px',
    5. 0: '0',
    6. 0.5: '0.125rem',
    7. 1: '0.25rem',
    8. 1.5: '0.375rem',
    9. 2: '0.5rem',
    10. 2.5: '0.625rem',
    11. 3: '0.75rem',
    12. 3.5: '0.875rem',
    13. 4: '1rem',
    14. 5: '1.25rem',
    15. 6: '1.5rem',
    16. 7: '1.75rem',
    17. 8: '2rem',
    18. 9: '2.25rem',
    19. 11: '2.75rem',
    20. 12: '3rem',
    21. 14: '3.5rem',
    22. 16: '4rem',
    23. 20: '5rem',
    24. 24: '6rem',
    25. 28: '7rem',
    26. 32: '8rem',
    27. 36: '9rem',
    28. 40: '10rem',
    29. 44: '11rem',
    30. 48: '12rem',
    31. 52: '13rem',
    32. 56: '14rem',
    33. 60: '15rem',
    34. 64: '16rem',
    35. 72: '18rem',
    36. 80: '20rem',
    37. 96: '24rem',
    38. },
    39. }
    40. }

    By default, these values are inherited by the padding, margin, width, height, maxHeight, flex-basis, gap, inset, space, translate, scrollMargin, scrollPadding, and textIndent core plugins.

    To learn more, see the spacing customization documentation.

    For example, the borderRadius key lets you customize which border radius utilities will be generated:

    1. module.exports = {
    2. theme: {
    3. borderRadius: {
    4. 'none': '0',
    5. 'sm': '.125rem',
    6. DEFAULT: '.25rem',
    7. 'lg': '.5rem',
    8. 'full': '9999px',
    9. },
    10. }
    11. }

    The keys determine the suffix for the generated classes, and the values determine the value of the actual CSS declaration.

    The example borderRadius configuration above would generate the following CSS classes:

    You’ll notice that using a key of DEFAULT in the theme configuration created the class rounded with no suffix. This is a common convention in Tailwind and is supported by all core plugins.

    To learn more about customizing a specific core plugin, visit the documentation for that plugin.

    For a complete reference of available theme properties and their default values, see the default theme configuration.


    Out of the box, your project will automatically inherit the values from the default theme configuration. If you would like to customize the default theme, you have a few different options depending on your goals.

    Extending the default theme

    If you’d like to preserve the default values for a theme option but also add new values, add your extensions under the extend key in the theme section of your configuration file.

    For example, if you wanted to add an extra breakpoint but preserve the existing ones, you could extend the screens property:

    tailwind.config.js

    1. module.exports = {
    2. theme: {
    3. extend: {
    4. // Adds a new breakpoint in addition to the default breakpoints
    5. screens: {
    6. '3xl': '1600px',
    7. }
    8. }
    9. }
    10. }

    Overriding the default theme

    To override an option in the default theme, add your overrides directly under the theme section of your tailwind.config.js:

    tailwind.config.js

    1. module.exports = {
    2. theme: {
    3. // Replaces all of the default `opacity` values
    4. opacity: {
    5. '0': '0',
    6. '20': '0.2',
    7. '40': '0.4',
    8. '60': '0.6',
    9. '80': '0.8',
    10. '100': '1',
    11. }
    12. }
    13. }

    This will completely replace Tailwind’s default configuration for that key, so in the example above none of the default opacity utilities would be generated.

    Any keys you do not provide will be inherited from the default theme, so in the above example, the default theme configuration for things like colors, spacing, border-radius, background-position, etc. would be preserved.

    You can of course both override some parts of the default theme and extend other parts of the default theme within the same configuration:

    tailwind.config.js

    1. module.exports = {
    2. opacity: {
    3. '0': '0',
    4. '20': '0.2',
    5. '40': '0.4',
    6. '60': '0.6',
    7. '80': '0.8',
    8. '100': '1',
    9. },
    10. extend: {
    11. screens: {
    12. '3xl': '1600px',
    13. }
    14. }
    15. }

    If you need to reference another value in your theme, you can do so by providing a closure instead of a static value. The closure will receive an object that includes a theme() function that you can use to look up other values in your theme using dot notation.

    tailwind.config.js

    1. module.exports = {
    2. theme: {
    3. spacing: {
    4. // ...
    5. },
    6. backgroundSize: ({ theme }) => ({
    7. auto: 'auto',
    8. cover: 'cover',
    9. contain: 'contain',
    10. ...theme('spacing')
    11. })
    12. }
    13. }

    The theme() function attempts to find the value you are looking for from the fully merged theme object, so it can reference your own customizations as well as the default theme values. It also works recursively, so as long as there is a static value at the end of the chain it will be able to resolve the value you are looking for.

    Note that you can only use this kind of closure with top-level theme keys, not the keys inside of each section.

    You can’t use functions for individual values

    tailwind.config.js

    Use functions for top-level theme keys

    tailwind.config.js

    1. module.exports = {
    2. theme: {
    3. fill: ({ theme }) => ({
    4. gray: theme('colors.gray')
    5. })
    6. }
    7. }

    Referencing the default theme

    If you’d like to reference a value in the default theme for any reason, you can import it from tailwindcss/defaultTheme.

    One example of where this is useful is if you’d like to add a font family to one of Tailwind’s default font stacks:

    tailwind.config.js

    1. const defaultTheme = require('tailwindcss/defaultTheme')
    2. module.exports = {
    3. theme: {
    4. extend: {
    5. fontFamily: {
    6. sans: [
    7. 'Lato',
    8. ...defaultTheme.fontFamily.sans,
    9. ]
    10. }
    11. }
    12. }
    13. }

    Disabling an entire core plugin

    If you don’t want to generate any classes for a certain core plugin, it’s better to set that plugin to false in your corePlugins configuration than to provide an empty object for that key in your theme configuration.

    Don’t assign an empty object in your theme configuration

    tailwind.config.js

    1. module.exports = {
    2. theme: {
    3. opacity: {},
    4. }
    5. }

    Do disable the plugin in your corePlugins configuration

    tailwind.config.js

    1. module.exports = {
    2. corePlugins: {
    3. opacity: false,
    4. }

    The end result is the same, but since many core plugins expose no configuration they can only be disabled using corePlugins anyways, so it’s better to be consistent.


    Except for screens, colors, and spacing, all of the keys in the theme object map to one of Tailwind’s . Since many plugins are responsible for CSS properties that only accept a static set of values (like float for example), note that not every plugin has a corresponding key in the theme object.