Loading tutorials
Intermediate · Mid: 16 chapters · 32 min read. States assumed prerequisites
Start reading@import "tailwindcss";. Nothing else is required. This chapter covers the CSS feature that @theme builds onvar(). It also assumes you have used Tailwind utility classes in HTML and have installed Tailwind v4 in a project. Here you will see where configuration lives in v4 and what the main directives do. The next chapters cover `@tvar(). It also assumes you have used Tailwind utility classes and know how to import Tailwind into a CSS file with @import "tailwindcss".@import "tailwindcss"; working in a CSS file. It also assumes you have seen a basic @theme block.var(). It also assumes you have used Tailwind utility classes in HTML and can import Tailwind into a CSS file with @import "tailwindcss";.var(), you have used Tailwind utility classes in HTML, and your project already imports Tailwind in a CSS file with @import "tailwindcss";.@theme defines tokens and how namespaces such as --color-* and --font-* map to utilities. Extending the default theme adds tokens next to Tailwind's defaults. Resetting removes defaults, so your design system contains only what you define.@theme, theme namespaces, and how a theme variable becomes a utility. It covers how one variable, --spacing, drives the whole spacing scale.var(), you have used Tailwind utility classes, and you have Tailwind v4 imported with @import "tailwindcss";. By the end, you should be able to pick @theme or :root for any variable.@theme and know how namespaces map to utilities. Here you will read those tokens from your own CSS rules.@keyframes rule, and how to import Tailwind into a CSS file with @import "tailwindcss";. You should also know how @theme namespaces map variable names to utility classes.var(), can use Tailwind utility classes, and have a CSS file that starts with @import "tailwindcss";. It covers one option of the @theme directive: inline.@theme block and know that theme variables generate utilities. It covers one question: which of your theme variables end up in the compiled CSS, and how to change that.var(), can use Tailwind utility classes, and have read the earlier chapters on @theme and @theme inline. Here you will build a theme that switches at runtime, such as light and dark mode.@theme block, know the difference between extending and resetting a namespace, and have Tailwind v4 installed through its Vite, PostCSS, or CLI integration.@theme, theme namespaces, and how Tailwind v4 is imported in a CSS file. You will move an existing JavaScript config into CSS, and learn when to keep the old file temporarily.