At the heart of every Tailwind project is a JavaScript configuration file that serves as the home for your project’s design system.

It’s where you define your color palette, font stacks, type scale, border sizes, breakpoints, opacity scale, you name it. Your config file is like an executable style guide for your project.

We provide a sensible default configuration with a very generous set of values to get you started, but you own this file; you’re encouraged to change it as much as you need to fit the goals of your design.

It’s important to understand that unlike other CSS frameworks you might have used, none of the settings in this file are coupled to each other. Nothing bad will happen even if you completely delete all of the values for a given module.

Generating your configuration file

Generate a Tailwind config file for your project using the Tailwind CLI utility included when you install the tailwindcss npm package:

./node_modules/.bin/tailwind init [filename]

By default, tailwind init will generate a tailwind.js config file at the root of your project, but feel free to name this file differently or store it in a different location if you prefer.

Default configuration

Your generated configuration file contains all of Tailwind’s default configuration values, ready for you to customize.

  1. /*
  2. Tailwind - The Utility-First CSS Framework
  3. A project by Adam Wathan (@adamwathan), Jonathan Reinink (@reinink),
  4. David Hemphill (@davidhemphill) and Steve Schoger (@steveschoger).
  5. Welcome to the Tailwind config file. This is where you can customize
  6. Tailwind specifically for your project. Don't be intimidated by the
  7. length of this file. It's really just a big JavaScript object and
  8. we've done our very best to explain each section.
  9. View the full documentation at https://tailwindcss.com.
  10. |-------------------------------------------------------------------------------
  11. | The default config
  12. |-------------------------------------------------------------------------------
  13. |
  14. | This variable contains the default Tailwind config. You don't have
  15. | to use it, but it can sometimes be helpful to have available. For
  16. | example, you may choose to merge your custom configuration
  17. | values with some of the Tailwind defaults.
  18. |
  19. */
  20. // let defaultConfig = require('tailwindcss/defaultConfig')()
  21. /*
  22. |-------------------------------------------------------------------------------
  23. | Colors https://tailwindcss.com/docs/colors
  24. |-------------------------------------------------------------------------------
  25. |
  26. | Here you can specify the colors used in your project. To get you started,
  27. | we've provided a generous palette of great looking colors that are perfect
  28. | for prototyping, but don't hesitate to change them for your project. You
  29. | own these colors, nothing will break if you change everything about them.
  30. |
  31. | We've used literal color names ("red", "blue", etc.) for the default
  32. | palette, but if you'd rather use functional names like "primary" and
  33. | "secondary", or even a numeric scale like "100" and "200", go for it.
  34. |
  35. */
  36. let colors = {
  37. 'transparent': 'transparent',
  38. 'black': '#22292f',
  39. 'grey-darkest': '#3d4852',
  40. 'grey-darker': '#606f7b',
  41. 'grey-dark': '#8795a1',
  42. 'grey': '#b8c2cc',
  43. 'grey-light': '#dae1e7',
  44. 'grey-lighter': '#f1f5f8',
  45. 'grey-lightest': '#f8fafc',
  46. 'white': '#ffffff',
  47. 'red-darkest': '#3b0d0c',
  48. 'red-darker': '#621b18',
  49. 'red-dark': '#cc1f1a',
  50. 'red': '#e3342f',
  51. 'red-light': '#ef5753',
  52. 'red-lighter': '#f9acaa',
  53. 'red-lightest': '#fcebea',
  54. 'orange-darkest': '#462a16',
  55. 'orange-darker': '#613b1f',
  56. 'orange-dark': '#de751f',
  57. 'orange': '#f6993f',
  58. 'orange-light': '#faad63',
  59. 'orange-lighter': '#fcd9b6',
  60. 'orange-lightest': '#fff5eb',
  61. 'yellow-darkest': '#453411',
  62. 'yellow-darker': '#684f1d',
  63. 'yellow-dark': '#f2d024',
  64. 'yellow': '#ffed4a',
  65. 'yellow-light': '#fff382',
  66. 'yellow-lighter': '#fff9c2',
  67. 'yellow-lightest': '#fcfbeb',
  68. 'green-darkest': '#0f2f21',
  69. 'green-darker': '#1a4731',
  70. 'green-dark': '#1f9d55',
  71. 'green': '#38c172',
  72. 'green-light': '#51d88a',
  73. 'green-lighter': '#a2f5bf',
  74. 'green-lightest': '#e3fcec',
  75. 'teal-darkest': '#0d3331',
  76. 'teal-darker': '#20504f',
  77. 'teal-dark': '#38a89d',
  78. 'teal': '#4dc0b5',
  79. 'teal-light': '#64d5ca',
  80. 'teal-lighter': '#a0f0ed',
  81. 'teal-lightest': '#e8fffe',
  82. 'blue-darkest': '#12283a',
  83. 'blue-darker': '#1c3d5a',
  84. 'blue-dark': '#2779bd',
  85. 'blue': '#3490dc',
  86. 'blue-light': '#6cb2eb',
  87. 'blue-lighter': '#bcdefa',
  88. 'blue-lightest': '#eff8ff',
  89. 'indigo-darkest': '#191e38',
  90. 'indigo-darker': '#2f365f',
  91. 'indigo-dark': '#5661b3',
  92. 'indigo': '#6574cd',
  93. 'indigo-light': '#7886d7',
  94. 'indigo-lighter': '#b2b7ff',
  95. 'indigo-lightest': '#e6e8ff',
  96. 'purple-darkest': '#21183c',
  97. 'purple-darker': '#382b5f',
  98. 'purple-dark': '#794acf',
  99. 'purple': '#9561e2',
  100. 'purple-light': '#a779e9',
  101. 'purple-lighter': '#d6bbfc',
  102. 'purple-lightest': '#f3ebff',
  103. 'pink-darkest': '#451225',
  104. 'pink-darker': '#6f213f',
  105. 'pink-dark': '#eb5286',
  106. 'pink': '#f66d9b',
  107. 'pink-light': '#fa7ea8',
  108. 'pink-lighter': '#ffbbca',
  109. 'pink-lightest': '#ffebef',
  110. }
  111. module.exports = {
  112. /*
  113. |-----------------------------------------------------------------------------
  114. | Colors https://tailwindcss.com/docs/colors
  115. |-----------------------------------------------------------------------------
  116. |
  117. | The color palette defined above is also assigned to the "colors" key of
  118. | your Tailwind config. This makes it easy to access them in your CSS
  119. | using Tailwind's config helper. For example:
  120. |
  121. | .error { color: config('colors.red') }
  122. |
  123. */
  124. colors: colors,
  125. /*
  126. |-----------------------------------------------------------------------------
  127. | Screens https://tailwindcss.com/docs/responsive-design
  128. |-----------------------------------------------------------------------------
  129. |
  130. | Screens in Tailwind are translated to CSS media queries. They define the
  131. | responsive breakpoints for your project. By default Tailwind takes a
  132. | "mobile first" approach, where each screen size represents a minimum
  133. | viewport width. Feel free to have as few or as many screens as you
  134. | want, naming them in whatever way you'd prefer for your project.
  135. |
  136. | Tailwind also allows for more complex screen definitions, which can be
  137. | useful in certain situations. Be sure to see the full responsive
  138. | documentation for a complete list of options.
  139. |
  140. | Class name: .{screen}:{utility}
  141. |
  142. */
  143. screens: {
  144. 'sm': '576px',
  145. 'md': '768px',
  146. 'lg': '992px',
  147. 'xl': '1200px',
  148. },
  149. /*
  150. |-----------------------------------------------------------------------------
  151. | Fonts https://tailwindcss.com/docs/fonts
  152. |-----------------------------------------------------------------------------
  153. |
  154. | Here is where you define your project's font stack, or font families.
  155. | Keep in mind that Tailwind doesn't actually load any fonts for you.
  156. | If you're using custom fonts you'll need to import them prior to
  157. | defining them here.
  158. |
  159. | By default we provide a native font stack that works remarkably well on
  160. | any device or OS you're using, since it just uses the default fonts
  161. | provided by the platform.
  162. |
  163. | Class name: .font-{name}
  164. | CSS property: font-family
  165. |
  166. */
  167. fonts: {
  168. 'sans': [
  169. 'system-ui',
  170. 'BlinkMacSystemFont',
  171. '-apple-system',
  172. 'Segoe UI',
  173. 'Roboto',
  174. 'Oxygen',
  175. 'Ubuntu',
  176. 'Cantarell',
  177. 'Fira Sans',
  178. 'Droid Sans',
  179. 'Helvetica Neue',
  180. 'sans-serif',
  181. ],
  182. 'serif': [
  183. 'Constantia',
  184. 'Lucida Bright',
  185. 'Lucidabright',
  186. 'Lucida Serif',
  187. 'Lucida',
  188. 'DejaVu Serif',
  189. 'Bitstream Vera Serif',
  190. 'Liberation Serif',
  191. 'Georgia',
  192. 'serif',
  193. ],
  194. 'mono': [
  195. 'Menlo',
  196. 'Monaco',
  197. 'Consolas',
  198. 'Liberation Mono',
  199. 'Courier New',
  200. 'monospace',
  201. ],
  202. },
  203. /*
  204. |-----------------------------------------------------------------------------
  205. | Text sizes https://tailwindcss.com/docs/text-sizing
  206. |-----------------------------------------------------------------------------
  207. |
  208. | Here is where you define your text sizes. Name these in whatever way
  209. | makes the most sense to you. We use size names by default, but
  210. | you're welcome to use a numeric scale or even something else
  211. | entirely.
  212. |
  213. | By default Tailwind uses the "rem" unit type for most measurements.
  214. | This allows you to set a root font size which all other sizes are
  215. | then based on. That said, you are free to use whatever units you
  216. | prefer, be it rems, ems, pixels or other.
  217. |
  218. | Class name: .text-{size}
  219. | CSS property: font-size
  220. |
  221. */
  222. textSizes: {
  223. 'xs': '.75rem', // 12px
  224. 'sm': '.875rem', // 14px
  225. 'base': '1rem', // 16px
  226. 'lg': '1.125rem', // 18px
  227. 'xl': '1.25rem', // 20px
  228. '2xl': '1.5rem', // 24px
  229. '3xl': '1.875rem', // 30px
  230. '4xl': '2.25rem', // 36px
  231. '5xl': '3rem', // 48px
  232. },
  233. /*
  234. |-----------------------------------------------------------------------------
  235. | Font weights https://tailwindcss.com/docs/font-weight
  236. |-----------------------------------------------------------------------------
  237. |
  238. | Here is where you define your font weights. We've provided a list of
  239. | common font weight names with their respective numeric scale values
  240. | to get you started. It's unlikely that your project will require
  241. | all of these, so we recommend removing those you don't need.
  242. |
  243. | Class name: .font-{weight}
  244. | CSS property: font-weight
  245. |
  246. */
  247. fontWeights: {
  248. 'hairline': 100,
  249. 'thin': 200,
  250. 'light': 300,
  251. 'normal': 400,
  252. 'medium': 500,
  253. 'semibold': 600,
  254. 'bold': 700,
  255. 'extrabold': 800,
  256. 'black': 900,
  257. },
  258. /*
  259. |-----------------------------------------------------------------------------
  260. | Leading (line height) https://tailwindcss.com/docs/line-height
  261. |-----------------------------------------------------------------------------
  262. |
  263. | Here is where you define your line height values, or as we call
  264. | them in Tailwind, leadings.
  265. |
  266. | Class name: .leading-{size}
  267. | CSS property: line-height
  268. |
  269. */
  270. leading: {
  271. 'none': 1,
  272. 'tight': 1.25,
  273. 'normal': 1.5,
  274. 'loose': 2,
  275. },
  276. /*
  277. |-----------------------------------------------------------------------------
  278. | Tracking (letter spacing) https://tailwindcss.com/docs/letter-spacing
  279. |-----------------------------------------------------------------------------
  280. |
  281. | Here is where you define your letter spacing values, or as we call
  282. | them in Tailwind, tracking.
  283. |
  284. | Class name: .tracking-{size}
  285. | CSS property: letter-spacing
  286. |
  287. */
  288. tracking: {
  289. 'tight': '-0.05em',
  290. 'normal': '0',
  291. 'wide': '0.05em',
  292. },
  293. /*
  294. |-----------------------------------------------------------------------------
  295. | Text colors https://tailwindcss.com/docs/text-color
  296. |-----------------------------------------------------------------------------
  297. |
  298. | Here is where you define your text colors. By default these use the
  299. | color palette we defined above, however you're welcome to set these
  300. | independently if that makes sense for your project.
  301. |
  302. | Class name: .text-{color}
  303. | CSS property: color
  304. |
  305. */
  306. textColors: colors,
  307. /*
  308. |-----------------------------------------------------------------------------
  309. | Background colors https://tailwindcss.com/docs/background-color
  310. |-----------------------------------------------------------------------------
  311. |
  312. | Here is where you define your background colors. By default these use
  313. | the color palette we defined above, however you're welcome to set
  314. | these independently if that makes sense for your project.
  315. |
  316. | Class name: .bg-{color}
  317. | CSS property: background-color
  318. |
  319. */
  320. backgroundColors: colors,
  321. /*
  322. |-----------------------------------------------------------------------------
  323. | Background sizes https://tailwindcss.com/docs/background-size
  324. |-----------------------------------------------------------------------------
  325. |
  326. | Here is where you define your background sizes. We provide some common
  327. | values that are useful in most projects, but feel free to add other sizes
  328. | that are specific to your project here as well.
  329. |
  330. | Class name: .bg-{size}
  331. | CSS property: background-size
  332. |
  333. */
  334. backgroundSize: {
  335. 'auto': 'auto',
  336. 'cover': 'cover',
  337. 'contain': 'contain',
  338. },
  339. /*
  340. |-----------------------------------------------------------------------------
  341. | Border widths https://tailwindcss.com/docs/border-width
  342. |-----------------------------------------------------------------------------
  343. |
  344. | Here is where you define your border widths. Take note that border
  345. | widths require a special "default" value set as well. This is the
  346. | width that will be used when you do not specify a border width.
  347. |
  348. | Class name: .border{-side?}{-width?}
  349. | CSS property: border-width
  350. |
  351. */
  352. borderWidths: {
  353. default: '1px',
  354. '0': '0',
  355. '2': '2px',
  356. '4': '4px',
  357. '8': '8px',
  358. },
  359. /*
  360. |-----------------------------------------------------------------------------
  361. | Border colors https://tailwindcss.com/docs/border-color
  362. |-----------------------------------------------------------------------------
  363. |
  364. | Here is where you define your border colors. By default these use the
  365. | color palette we defined above, however you're welcome to set these
  366. | independently if that makes sense for your project.
  367. |
  368. | Take note that border colors require a special "default" value set
  369. | as well. This is the color that will be used when you do not
  370. | specify a border color.
  371. |
  372. | Class name: .border-{color}
  373. | CSS property: border-color
  374. |
  375. */
  376. borderColors: global.Object.assign({ default: colors['grey-light'] }, colors),
  377. /*
  378. |-----------------------------------------------------------------------------
  379. | Border radius https://tailwindcss.com/docs/border-radius
  380. |-----------------------------------------------------------------------------
  381. |
  382. | Here is where you define your border radius values. If a `default` radius
  383. | is provided, it will be made available as the non-suffixed `.rounded`
  384. | utility.
  385. |
  386. | If your scale includes a `0` value to reset already rounded corners, it's
  387. | a good idea to put it first so other values are able to override it.
  388. |
  389. | Class name: .rounded{-side?}{-size?}
  390. | CSS property: border-radius
  391. |
  392. */
  393. borderRadius: {
  394. 'none': '0',
  395. 'sm': '.125rem',
  396. default: '.25rem',
  397. 'lg': '.5rem',
  398. 'full': '9999px',
  399. },
  400. /*
  401. |-----------------------------------------------------------------------------
  402. | Width https://tailwindcss.com/docs/width
  403. |-----------------------------------------------------------------------------
  404. |
  405. | Here is where you define your width utility sizes. These can be
  406. | percentage based, pixels, rems, or any other units. By default
  407. | we provide a sensible rem based numeric scale, a percentage
  408. | based fraction scale, plus some other common use-cases. You
  409. | can, of course, modify these values as needed.
  410. |
  411. |
  412. | It's also worth mentioning that Tailwind automatically escapes
  413. | invalid CSS class name characters, which allows you to have
  414. | awesome classes like .w-2/3.
  415. |
  416. | Class name: .w-{size}
  417. | CSS property: width
  418. |
  419. */
  420. width: {
  421. 'auto': 'auto',
  422. 'px': '1px',
  423. '1': '0.25rem',
  424. '2': '0.5rem',
  425. '3': '0.75rem',
  426. '4': '1rem',
  427. '5': '1.25rem',
  428. '6': '1.5rem',
  429. '8': '2rem',
  430. '10': '2.5rem',
  431. '12': '3rem',
  432. '16': '4rem',
  433. '24': '6rem',
  434. '32': '8rem',
  435. '48': '12rem',
  436. '64': '16rem',
  437. '1/2': '50%',
  438. '1/3': '33.33333%',
  439. '2/3': '66.66667%',
  440. '1/4': '25%',
  441. '3/4': '75%',
  442. '1/5': '20%',
  443. '2/5': '40%',
  444. '3/5': '60%',
  445. '4/5': '80%',
  446. '1/6': '16.66667%',
  447. '5/6': '83.33333%',
  448. 'full': '100%',
  449. 'screen': '100vw',
  450. },
  451. /*
  452. |-----------------------------------------------------------------------------
  453. | Height https://tailwindcss.com/docs/height
  454. |-----------------------------------------------------------------------------
  455. |
  456. | Here is where you define your height utility sizes. These can be
  457. | percentage based, pixels, rems, or any other units. By default
  458. | we provide a sensible rem based numeric scale plus some other
  459. | common use-cases. You can, of course, modify these values as
  460. | needed.
  461. |
  462. | Class name: .h-{size}
  463. | CSS property: height
  464. |
  465. */
  466. height: {
  467. 'auto': 'auto',
  468. 'px': '1px',
  469. '1': '0.25rem',
  470. '2': '0.5rem',
  471. '3': '0.75rem',
  472. '4': '1rem',
  473. '5': '1.25rem',
  474. '6': '1.5rem',
  475. '8': '2rem',
  476. '10': '2.5rem',
  477. '12': '3rem',
  478. '16': '4rem',
  479. '24': '6rem',
  480. '32': '8rem',
  481. '48': '12rem',
  482. '64': '16rem',
  483. 'full': '100%',
  484. 'screen': '100vh',
  485. },
  486. /*
  487. |-----------------------------------------------------------------------------
  488. | Minimum width https://tailwindcss.com/docs/min-width
  489. |-----------------------------------------------------------------------------
  490. |
  491. | Here is where you define your minimum width utility sizes. These can
  492. | be percentage based, pixels, rems, or any other units. We provide a
  493. | couple common use-cases by default. You can, of course, modify
  494. | these values as needed.
  495. |
  496. | Class name: .min-w-{size}
  497. | CSS property: min-width
  498. |
  499. */
  500. minWidth: {
  501. '0': '0',
  502. 'full': '100%',
  503. },
  504. /*
  505. |-----------------------------------------------------------------------------
  506. | Minimum height https://tailwindcss.com/docs/min-height
  507. |-----------------------------------------------------------------------------
  508. |
  509. | Here is where you define your minimum height utility sizes. These can
  510. | be percentage based, pixels, rems, or any other units. We provide a
  511. | few common use-cases by default. You can, of course, modify these
  512. | values as needed.
  513. |
  514. | Class name: .min-h-{size}
  515. | CSS property: min-height
  516. |
  517. */
  518. minHeight: {
  519. '0': '0',
  520. 'full': '100%',
  521. 'screen': '100vh',
  522. },
  523. /*
  524. |-----------------------------------------------------------------------------
  525. | Maximum width https://tailwindcss.com/docs/max-width
  526. |-----------------------------------------------------------------------------
  527. |
  528. | Here is where you define your maximum width utility sizes. These can
  529. | be percentage based, pixels, rems, or any other units. By default
  530. | we provide a sensible rem based scale and a "full width" size,
  531. | which is basically a reset utility. You can, of course,
  532. | modify these values as needed.
  533. |
  534. | Class name: .max-w-{size}
  535. | CSS property: max-width
  536. |
  537. */
  538. maxWidth: {
  539. 'xs': '20rem',
  540. 'sm': '30rem',
  541. 'md': '40rem',
  542. 'lg': '50rem',
  543. 'xl': '60rem',
  544. '2xl': '70rem',
  545. '3xl': '80rem',
  546. '4xl': '90rem',
  547. '5xl': '100rem',
  548. 'full': '100%',
  549. },
  550. /*
  551. |-----------------------------------------------------------------------------
  552. | Maximum height https://tailwindcss.com/docs/max-height
  553. |-----------------------------------------------------------------------------
  554. |
  555. | Here is where you define your maximum height utility sizes. These can
  556. | be percentage based, pixels, rems, or any other units. We provide a
  557. | couple common use-cases by default. You can, of course, modify
  558. | these values as needed.
  559. |
  560. | Class name: .max-h-{size}
  561. | CSS property: max-height
  562. |
  563. */
  564. maxHeight: {
  565. 'full': '100%',
  566. 'screen': '100vh',
  567. },
  568. /*
  569. |-----------------------------------------------------------------------------
  570. | Padding https://tailwindcss.com/docs/padding
  571. |-----------------------------------------------------------------------------
  572. |
  573. | Here is where you define your padding utility sizes. These can be
  574. | percentage based, pixels, rems, or any other units. By default we
  575. | provide a sensible rem based numeric scale plus a couple other
  576. | common use-cases like "1px". You can, of course, modify these
  577. | values as needed.
  578. |
  579. | Class name: .p{side?}-{size}
  580. | CSS property: padding
  581. |
  582. */
  583. padding: {
  584. 'px': '1px',
  585. '0': '0',
  586. '1': '0.25rem',
  587. '2': '0.5rem',
  588. '3': '0.75rem',
  589. '4': '1rem',
  590. '5': '1.25rem',
  591. '6': '1.5rem',
  592. '8': '2rem',
  593. '10': '2.5rem',
  594. '12': '3rem',
  595. '16': '4rem',
  596. '20': '5rem',
  597. '24': '6rem',
  598. '32': '8rem',
  599. },
  600. /*
  601. |-----------------------------------------------------------------------------
  602. | Margin https://tailwindcss.com/docs/margin
  603. |-----------------------------------------------------------------------------
  604. |
  605. | Here is where you define your margin utility sizes. These can be
  606. | percentage based, pixels, rems, or any other units. By default we
  607. | provide a sensible rem based numeric scale plus a couple other
  608. | common use-cases like "1px". You can, of course, modify these
  609. | values as needed.
  610. |
  611. | Class name: .m{side?}-{size}
  612. | CSS property: margin
  613. |
  614. */
  615. margin: {
  616. 'auto': 'auto',
  617. 'px': '1px',
  618. '0': '0',
  619. '1': '0.25rem',
  620. '2': '0.5rem',
  621. '3': '0.75rem',
  622. '4': '1rem',
  623. '5': '1.25rem',
  624. '6': '1.5rem',
  625. '8': '2rem',
  626. '10': '2.5rem',
  627. '12': '3rem',
  628. '16': '4rem',
  629. '20': '5rem',
  630. '24': '6rem',
  631. '32': '8rem',
  632. },
  633. /*
  634. |-----------------------------------------------------------------------------
  635. | Negative margin https://tailwindcss.com/docs/negative-margin
  636. |-----------------------------------------------------------------------------
  637. |
  638. | Here is where you define your negative margin utility sizes. These can
  639. | be percentage based, pixels, rems, or any other units. By default we
  640. | provide matching values to the padding scale since these utilities
  641. | generally get used together. You can, of course, modify these
  642. | values as needed.
  643. |
  644. | Class name: .-m{side?}-{size}
  645. | CSS property: margin
  646. |
  647. */
  648. negativeMargin: {
  649. 'px': '1px',
  650. '0': '0',
  651. '1': '0.25rem',
  652. '2': '0.5rem',
  653. '3': '0.75rem',
  654. '4': '1rem',
  655. '5': '1.25rem',
  656. '6': '1.5rem',
  657. '8': '2rem',
  658. '10': '2.5rem',
  659. '12': '3rem',
  660. '16': '4rem',
  661. '20': '5rem',
  662. '24': '6rem',
  663. '32': '8rem',
  664. },
  665. /*
  666. |-----------------------------------------------------------------------------
  667. | Shadows https://tailwindcss.com/docs/shadows
  668. |-----------------------------------------------------------------------------
  669. |
  670. | Here is where you define your shadow utilities. As you can see from
  671. | the defaults we provide, it's possible to apply multiple shadows
  672. | per utility using comma separation.
  673. |
  674. | If a `default` shadow is provided, it will be made available as the non-
  675. | suffixed `.shadow` utility.
  676. |
  677. | Class name: .shadow-{size?}
  678. | CSS property: box-shadow
  679. |
  680. */
  681. shadows: {
  682. default: '0 2px 4px 0 rgba(0,0,0,0.10)',
  683. 'md': '0 4px 8px 0 rgba(0,0,0,0.12), 0 2px 4px 0 rgba(0,0,0,0.08)',
  684. 'lg': '0 15px 30px 0 rgba(0,0,0,0.11), 0 5px 15px 0 rgba(0,0,0,0.08)',
  685. 'inner': 'inset 0 2px 4px 0 rgba(0,0,0,0.06)',
  686. 'outline': '0 0 0 3px rgba(52,144,220,0.5)',
  687. 'none': 'none',
  688. },
  689. /*
  690. |-----------------------------------------------------------------------------
  691. | Z-index https://tailwindcss.com/docs/z-index
  692. |-----------------------------------------------------------------------------
  693. |
  694. | Here is where you define your z-index utility values. By default we
  695. | provide a sensible numeric scale. You can, of course, modify these
  696. | values as needed.
  697. |
  698. | Class name: .z-{index}
  699. | CSS property: z-index
  700. |
  701. */
  702. zIndex: {
  703. 'auto': 'auto',
  704. '0': 0,
  705. '10': 10,
  706. '20': 20,
  707. '30': 30,
  708. '40': 40,
  709. '50': 50,
  710. },
  711. /*
  712. |-----------------------------------------------------------------------------
  713. | Opacity https://tailwindcss.com/docs/opacity
  714. |-----------------------------------------------------------------------------
  715. |
  716. | Here is where you define your opacity utility values. By default we
  717. | provide a sensible numeric scale. You can, of course, modify these
  718. | values as needed.
  719. |
  720. | Class name: .opacity-{name}
  721. | CSS property: opacity
  722. |
  723. */
  724. opacity: {
  725. '0': '0',
  726. '25': '.25',
  727. '50': '.5',
  728. '75': '.75',
  729. '100': '1',
  730. },
  731. /*
  732. |-----------------------------------------------------------------------------
  733. | SVG fill https://tailwindcss.com/docs/svg
  734. |-----------------------------------------------------------------------------
  735. |
  736. | Here is where you define your SVG fill colors. By default we just provide
  737. | `fill-current` which sets the fill to the current text color. This lets you
  738. | specify a fill color using existing text color utilities and helps keep the
  739. | generated CSS file size down.
  740. |
  741. | Class name: .fill-{name}
  742. | CSS property: fill
  743. |
  744. */
  745. svgFill: {
  746. 'current': 'currentColor',
  747. },
  748. /*
  749. |-----------------------------------------------------------------------------
  750. | SVG stroke https://tailwindcss.com/docs/svg
  751. |-----------------------------------------------------------------------------
  752. |
  753. | Here is where you define your SVG stroke colors. By default we just provide
  754. | `stroke-current` which sets the stroke to the current text color. This lets
  755. | you specify a stroke color using existing text color utilities and helps
  756. | keep the generated CSS file size down.
  757. |
  758. | Class name: .stroke-{name}
  759. | CSS property: stroke
  760. |
  761. */
  762. svgStroke: {
  763. 'current': 'currentColor',
  764. },
  765. /*
  766. |-----------------------------------------------------------------------------
  767. | Modules https://tailwindcss.com/docs/configuration#modules
  768. |-----------------------------------------------------------------------------
  769. |
  770. | Here is where you control which modules are generated and what variants are
  771. | generated for each of those modules.
  772. |
  773. | Currently supported variants:
  774. | - responsive
  775. | - hover
  776. | - focus
  777. | - focus-within
  778. | - active
  779. | - group-hover
  780. |
  781. | To disable a module completely, use `false` instead of an array.
  782. |
  783. */
  784. modules: {
  785. appearance: ['responsive'],
  786. backgroundAttachment: ['responsive'],
  787. backgroundColors: ['responsive', 'hover', 'focus'],
  788. backgroundPosition: ['responsive'],
  789. backgroundRepeat: ['responsive'],
  790. backgroundSize: ['responsive'],
  791. borderCollapse: [],
  792. borderColors: ['responsive', 'hover', 'focus'],
  793. borderRadius: ['responsive'],
  794. borderStyle: ['responsive'],
  795. borderWidths: ['responsive'],
  796. cursor: ['responsive'],
  797. display: ['responsive'],
  798. flexbox: ['responsive'],
  799. float: ['responsive'],
  800. fonts: ['responsive'],
  801. fontWeights: ['responsive', 'hover', 'focus'],
  802. height: ['responsive'],
  803. leading: ['responsive'],
  804. lists: ['responsive'],
  805. margin: ['responsive'],
  806. maxHeight: ['responsive'],
  807. maxWidth: ['responsive'],
  808. minHeight: ['responsive'],
  809. minWidth: ['responsive'],
  810. negativeMargin: ['responsive'],
  811. objectFit: false,
  812. objectPosition: false,
  813. opacity: ['responsive'],
  814. outline: ['focus'],
  815. overflow: ['responsive'],
  816. padding: ['responsive'],
  817. pointerEvents: ['responsive'],
  818. position: ['responsive'],
  819. resize: ['responsive'],
  820. shadows: ['responsive', 'hover', 'focus'],
  821. svgFill: [],
  822. svgStroke: [],
  823. tableLayout: ['responsive'],
  824. textAlign: ['responsive'],
  825. textColors: ['responsive', 'hover', 'focus'],
  826. textSizes: ['responsive'],
  827. textStyle: ['responsive', 'hover', 'focus'],
  828. tracking: ['responsive'],
  829. userSelect: ['responsive'],
  830. verticalAlign: ['responsive'],
  831. visibility: ['responsive'],
  832. whitespace: ['responsive'],
  833. width: ['responsive'],
  834. zIndex: ['responsive'],
  835. },
  836. /*
  837. |-----------------------------------------------------------------------------
  838. | Plugins https://tailwindcss.com/docs/plugins
  839. |-----------------------------------------------------------------------------
  840. |
  841. | Here is where you can register any plugins you'd like to use in your
  842. | project. Tailwind's built-in `container` plugin is enabled by default to
  843. | give you a Bootstrap-style responsive container component out of the box.
  844. |
  845. | Be sure to view the complete plugin documentation to learn more about how
  846. | the plugin system works.
  847. |
  848. */
  849. plugins: [
  850. require('tailwindcss/plugins/container')({
  851. // center: true,
  852. // padding: '1rem',
  853. }),
  854. ],
  855. /*
  856. |-----------------------------------------------------------------------------
  857. | Advanced Options https://tailwindcss.com/docs/configuration#options
  858. |-----------------------------------------------------------------------------
  859. |
  860. | Here is where you can tweak advanced configuration options. We recommend
  861. | leaving these options alone unless you absolutely need to change them.
  862. |
  863. */
  864. options: {
  865. prefix: '',
  866. important: false,
  867. separator: ':',
  868. },
  869. }

Configuration Sections

Colors

The colors property doesn’t actually affect your generated CSS on its own, but it’s the perfect place to centralize your color palette so you can refer to it in your own CSS using Tailwind’s config() function.

  1. // ...
  2. var colors = {
  3. 'transparent': 'transparent',
  4. // ...
  5. 'pink-lightest': '#ffebef',
  6. }
  7. // ...
  8. module.exports = {
  9. // ...
  10. colors: colors,
  11. // ...
  12. }

By default, the colors property simply references a colors variable defined earlier in the file. Using a separate variable for your color palette like this makes it easy to re-use those colors when defining the color palette for individual utilities, like background colors, text colors, or border colors.

Learn more about defining colors in Tailwind in the Colors documentation.

Screens

The screens property is where you define your project’s breakpoints, and will be used to generate responsive versions of Tailwind’s utility classes.

  1. // ...
  2. module.exports = {
  3. // ...
  4. screens: {
  5. 'sm': '576px',
  6. 'md': '768px',
  7. 'lg': '992px',
  8. 'xl': '1200px',
  9. },
  10. // ...
  11. }

We provide a familiar set of breakpoints that you might recognize from Bootstrap to get you started, but you’re free to change these as needed to suit your project.

Learn more about customizing screens in the Responsive Design documentation.

Styles

The next set of properties define all of the values you’d like to use for utilities that are dynamically generated.

This includes things like:

  • Background colors
  • Border widths
  • Font families
  • Font weights
  • Text sizes
  • Padding, margin, and negative margin scales
  • Width and height scales

…and many others.

For example, here’s the section used to customize which border radius utilities will be generated:

  1. // ...
  2. module.exports = {
  3. // ...
  4. /*
  5. |-----------------------------------------------------------------------------
  6. | Border radius https://tailwindcss.com/docs/border-radius
  7. |-----------------------------------------------------------------------------
  8. |
  9. | Here is where you define your border radius values. If a `default` radius
  10. | is provided, it will be made available as the non-suffixed `.rounded`
  11. | utility.
  12. |
  13. | If your scale includes a `0` value to reset already rounded corners, it's
  14. | a good idea to put it first so other values are able to override it.
  15. |
  16. | Class name: .rounded{-side?}{-size?}
  17. |
  18. */
  19. borderRadius: {
  20. 'none': '0',
  21. 'sm': '.125rem',
  22. default: '.25rem',
  23. 'lg': '.5rem',
  24. 'full': '9999px',
  25. },
  26. // ...
  27. }

Read through the generated config file or visit the “customizing” documentation for each module to learn more.

Modules

The modules property is where you control which modules are generated, and what state variants to generate for each module.

  1. // ...
  2. module.exports = {
  3. // ...
  4. modules: {
  5. appearance: ['responsive'],
  6. backgroundAttachment: ['responsive'],
  7. backgroundColors: ['responsive', 'hover'],
  8. backgroundPosition: ['responsive'],
  9. backgroundRepeat: ['responsive'],
  10. // ...
  11. },
  12. // ...
  13. }

Each property is a module name pointing to an array of state variants to generate for that module.

The available state variants are:

  • responsive, for generating breakpoint-specific versions of those utilities
  • hover, for generating versions of those utilities that only take effect on hover
  • focus, for generating versions of those utilities that only take effect on focus
  • active, for generating versions of those utilities that only take effect when an element is active
  • group-hover, for generating versions of those utilities that only take effect when a marked parent element is hovered
  • focus-within, for generating versions of those utilities that only take effect when a child element has focus

…as well as any custom variants added through plugins.

It’s important to note that (responsive excluded) variants are generated in the order you specify them, so variants at the end of the list will take precedence over variants at the beginning of the list.

Learn more about state variants in the “State Variants” documentation.

To include a module but not generate any state variants, use an empty array:

  1. // ...
  2. module.exports = {
  3. // ...
  4. modules: {
  5. // Include the `appearance` utilities, but not responsive,
  6. // focus, hover, etc. versions.
  7. appearance: [],
  8. // ...
  9. },
  10. // ...
  11. }

To completely disable a module, set it to false:

  1. // ...
  2. module.exports = {
  3. // ...
  4. modules: {
  5. // Don't include this module at all.
  6. appearance: false,
  7. // ...
  8. },
  9. // ...
  10. }

If a module is missing from your configuration file, the default configuration for that module will be used.

Options

Prefix

The prefix option allows you to add a custom prefix to all of Tailwind’s generated utility classes.

This can be really useful when layering Tailwind on top of existing CSS where there might be naming conflicts.

For example, you could add a tw- prefix by setting the prefix option like so:

  1. {
  2. // ...
  3. options: {
  4. prefix: 'tw-',
  5. // ...
  6. }
  7. }

You can also pass a function to the prefix option if you need more fine-grained control:

  1. {
  2. // ...
  3. options: {
  4. prefix: function (selector) {
  5. if (selector === '.container') {
  6. return 'tw-'
  7. }
  8. return ''
  9. },
  10. // ...
  11. }
  12. }

It’s important to understand that this prefix is added to the beginning of each utility name, not to the entire class name.

That means that classes with responsive or state prefixes like sm: or hover: will still have the responsive or state prefix first, with your custom prefix appearing after the colon:

  1. <div class="tw-text-lg md:tw-text-xl tw-bg-red hover:tw-bg-blue">
  2. <!-- -->
  3. </div>

Prefixes are only added to standard Tailwind utilities; no prefix will be added to your own custom utilities.

That means if you add your own responsive utility like this:

  1. @responsive {
  2. .bg-brand-gradient { ... }
  3. }

…the generated responsive classes will not have your configured prefix:

  1. .bg-brand-gradient { ... }
  2. @media (min-width: 576px) {
  3. .sm\:bg-brand-gradient { ... }
  4. }
  5. @media (min-width: 768px) {
  6. .md\:bg-brand-gradient { ... }
  7. }
  8. @media (min-width: 992) {
  9. .lg\:bg-brand-gradient { ... }
  10. }
  11. @media (min-width: 1200px) {
  12. .xl\:bg-brand-gradient { ... }
  13. }

If you’d like to prefix your own utilities as well, just add the prefix to the class definition:

  1. @responsive {
  2. .tw-bg-brand-gradient { ... }
  3. }

Important

The important option lets you control whether or not Tailwind’s utilities should be marked with !important.

This can be really useful when using Tailwind with existing CSS that has high specificity selectors.

To generate utilities as !important, set the important key in your configuration options to true:

  1. {
  2. // ...
  3. options: {
  4. important: true,
  5. // ...
  6. }
  7. }

Now all of Tailwind’s utility classes will be generated as !important:

  1. .leading-none {
  2. line-height: 1 !important;
  3. }
  4. .leading-tight {
  5. line-height: 1.25 !important;
  6. }
  7. .leading-normal {
  8. line-height: 1.5 !important;
  9. }
  10. .leading-loose {
  11. line-height: 2 !important;
  12. }

Note that any of your own custom utilities will not be marked as !important just by enabling this option.

If you’d like to make your own utilities !important, just add !important to the end of each declaration yourself:

  1. @responsive {
  2. .bg-brand-gradient {
  3. background-image: linear-gradient(#3490dc, #6574cd) !important;
  4. }
  5. }

Separator

The separator option lets you customize what character or string should be used to separate state variant prefixes (screen sizes, hover, focus, etc.) from utility names (text-center, items-end, etc.).

We use a colon by default (:), but it can be useful to change this if you’re using a templating language like Pug that doesn’t support special characters in class names.

  1. // ...
  2. module.exports = {
  3. // ...
  4. options: {
  5. // ...
  6. separator: '_',
  7. },
  8. }