@theme

The Tailwind CSS version 4 directive where you declare design tokens in CSS, which become both CSS variables and utility classes.

In more detail

Writing @theme { --color-brand: #2563eb; } creates a --color-brand custom property on :root and utilities such as bg-brand and text-brand that use it. The token's namespace, such as --color- or --spacing-, decides which utilities are generated.

Example

@theme { --color-accent: oklch(65% 0.22 140); } generates bg-accent and text-accent.

Related terms

Taught in

References