Skip to content

Tailwind Theme FAQ

Common questions about setting up, using, and troubleshooting the DesignPush Tailwind theme.


  • New build: Use the theme in replace mode. Your design system is the only vocabulary — Tailwind’s default classes like bg-blue-500 or p-4 are not available. See New build setup.
  • Existing site: Use preset.js in extend mode. Your DesignPush tokens are added alongside Tailwind’s defaults. Nothing breaks, migrate gradually. See Existing site setup.

Depends on your project type. See the main guide for step-by-step setup for both bundler and HTML projects.

For bundler projects (theme.css), you need tailwindcss v4+ installed. For HTML projects (preset.js + v3 CDN), nothing to install.

Yes — via preset.js. The export includes both theme.css (v4) and preset.js (v3). The v3 CDN approach works for both new builds and existing sites.


Replace (theme: presetTheme): Your design system is the complete theme. Tailwind’s built-in classes (bg-blue-500, p-4, font-sans) don’t exist. Only your token names work. Best for new builds.

Extend (theme: { extend: presetTheme }): Your tokens are added alongside Tailwind’s defaults. Both bg-blue-500 and bg-brand-primary-500 work. Best for existing sites.

No. The @theme directive always replaces Tailwind’s defaults. For extend mode with a v4 bundler, use preset.js via @config:

tailwind.config.js
const preset = require('./design-system/build/tailwind/preset');
module.exports = {
theme: { extend: preset.theme }
}

Can I use Tailwind’s default color names like red-500 or blue-500?

Section titled “Can I use Tailwind’s default color names like red-500 or blue-500?”

In replace mode (new build): No. The theme replaces Tailwind’s default palette entirely.

In extend mode (existing site): Yes. Default classes keep working alongside DesignPush classes.

In replace mode: The theme replaces Tailwind’s numeric spacing with named tokens (p-sm, p-md, p-lg).

In extend mode: They still work. Both p-4 and p-md are available.


Why do semantic color classes render as transparent?

Section titled “Why do semantic color classes render as transparent?”

You’re missing variables.css. Semantic colors reference CSS custom properties defined there.

Bundler: Add @import '../design-system/build/core/variables.css'; before the theme import.

HTML: Add <link rel="stylesheet" href="./design-system/build/core/variables.css"> to <head>.

What’s the difference between primitive and semantic colors?

Section titled “What’s the difference between primitive and semantic colors?”

Primitive colors are literal hex values. They don’t change with the theme.

<div class="bg-brand-primary-500">Always this exact color</div>

Semantic colors are CSS variable references. They adapt to light/dark mode.

<div class="bg-semantic-surface-neutral-subtle">Adapts to light/dark</div>

How do I use brand vs feedback vs neutral colors?

Section titled “How do I use brand vs feedback vs neutral colors?”
  • Brand: bg-brand-primary-500, text-brand-secondary-300, border-brand-accent-700
  • Feedback: bg-feedback-error-500, text-feedback-success-600, border-feedback-warning-300
  • Neutral: bg-neutral-gray-100, text-neutral-gray-800, border-neutral-gray-300

Each palette has shades from 50 to 950. Neutral also includes white and black.


Through CSS custom properties. Your variables.css defines semantic color values for both [data-theme="light"] and [data-theme="dark"] selectors. The theme references those variables, so semantic colors update automatically.

<html data-theme="light"> <!-- or "dark" -->
function toggleTheme() {
const html = document.documentElement;
const next = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
html.setAttribute('data-theme', next);
}

No. Only semantic-* classes respond to theme changes.


The theme provides font family names but not the font files. variables.css includes @import url(...) statements that load them — but in bundler setups (Vite, Next, Astro), CSS @import chains get concatenated and those font imports end up mid-file where browsers silently ignore them.

Fix for bundler setups: Check the README.md in your exported build/tailwind/ folder — it includes the exact <link> tags for your selected fonts. Add them to your HTML <head>.

HTML setups (<link> tag loading) work without this step.

Depends on your design system, but typically: font-display, font-heading, font-body, font-mono.

DesignPush generates fluid font sizes that scale between viewport widths. Just use text-base, text-lg, text-2xl — the fluid scaling is automatic.


Named tokens instead of numbers. Common scale:

ClassTypical value
p-zero0rem
p-xs0.125rem
p-sm0.25rem
p-md0.375rem
p-lg0.5rem
p-xl0.75rem
p-2xl1rem
p-3xl1.5rem
p-4xl2rem

Exact values depend on your tokens. Check preview.html for the current scale.

Yes. Tailwind’s arbitrary value syntax always works, regardless of the theme.


<div class="shadow-elevation-1">Subtle lift</div>
<div class="shadow-elevation-3">Card</div>
<div class="shadow-elevation-5">Modal overlay</div>

Yes. In v3 they work as standard utilities (opacity-alpha-50, z-layer-50). In v4 they’re :root properties and use arbitrary value syntax (opacity-[--opacity-alpha-50], z-[--z-layer-50]).


v3 (preset.js): Both work as direct utility classes:

<button class="transition-colors ease-standard duration-fast">Hover me</button>

v4 (theme.css): Easing works directly, duration uses arbitrary value syntax:

<button class="transition-colors ease-standard duration-[--duration-fast]">Hover me</button>

Typically: xs: (320px), sm: (640px), md: (768px), lg: (1024px), xl: (1280px), 2xl: (1536px).

In replace mode, these are the only breakpoints. In extend mode, they’re added alongside any defaults with the same names (values from your design system take precedence).


A self-contained page that showcases every primitive and semantic token — colors, typography, spacing, radii, shadows, motion, breakpoints. Open in any browser, no build step needed.

Includes a Default TW / DesignPush comparison toggle and dark mode toggle.

It loads the Tailwind v3 CDN to generate utility classes on the fly.

No. It’s a development/review tool. Use the theme in your normal build pipeline for production.

The preview covers primitive and semantic tokens only

Section titled “The preview covers primitive and semantic tokens only”

Component-level tokens (patterns, variants, sizes) are not included — those are handled by the dp-react component library.


app/globals.css
@import "tailwindcss";
@import "../design-system/build/core/variables.css";
@import "../design-system/build/tailwind/theme.css";
src/index.css
@import "tailwindcss";
@import "../design-system/build/core/variables.css";
@import "../design-system/build/tailwind/theme.css";
src/styles/global.css
@import "tailwindcss";
@import "../design-system/build/core/variables.css";
@import "../design-system/build/tailwind/theme.css";

The @theme custom properties are on :root, so you can access them in any approach:

getComputedStyle(document.documentElement).getPropertyValue('--color-brand-primary-500');

  1. Re-export from DesignPush.
  2. Replace the build/tailwind/ folder.
  3. Dev server hot-reloads automatically.

You can, but changes are overwritten on next export. Extend via a second @theme block instead.

Do I need to re-export if I only changed semantic color values?

Section titled “Do I need to re-export if I only changed semantic color values?”

Only re-export variables.css (in build/core/). The theme references semantic colors by variable name, not value.

If you added or removed semantic token keys, re-export both.

Pattern-level tokens, component-level tokens, semantic typography composites, semantic spacing aliases, focus ring tokens, and transition composites. These are handled by the dp-react component library.