Skip to content
TopClass UI

CSS entry

Three import lines, in order, and no configuration file. That is the whole Tailwind setup.

The three lines

app/globals.css
@import "tailwindcss";
@import "topclassui/tokens.css";
@import "topclassui/styles.css";

What each line brings

Line, Brings
LineBrings
tailwindcssTailwind itself: the base layer and the utility classes
topclassui/tokens.cssEvery --tc-* variable, the three mode blocks, the knobs and the Arabic font rule
topclassui/styles.cssThe @source line that scans the components, the @theme inline mapping and the variants for forced states

Why there is no tailwind.config.js

Tailwind v4 is configured in CSS. The third import carries the mapping and the @source line, so it can never fall out of step with the components.

The utility names you get

Every token becomes a utility class, with the same names the components use.

Token, Utilities
TokenUtilities
--tc-pagebg-page
--tc-surface--tc-surface-raisedbg-surfacebg-surface-raised
--tc-bodytext-body
--tc-mutedtext-muted
--tc-line--tc-line-strongborder-lineborder-line-strong
--tc-overlaybg-overlay
--tc-ringoutline-ring
--tc-primary-solid--tc-primary-on-solid--tc-primary-soft--tc-primary-on-softbg-primary-solidtext-primary-on-solidbg-primary-softtext-primary-on-soft
--tc-neutral-solid--tc-neutral-on-solid--tc-neutral-soft--tc-neutral-on-softbg-neutral-solidtext-neutral-on-solidbg-neutral-softtext-neutral-on-soft
--tc-success-solid--tc-success-on-solid--tc-success-soft--tc-success-on-softbg-success-solidtext-success-on-solidbg-success-softtext-success-on-soft
--tc-warning-solid--tc-warning-on-solid--tc-warning-soft--tc-warning-on-softbg-warning-solidtext-warning-on-solidbg-warning-softtext-warning-on-soft
--tc-danger-solid--tc-danger-on-solid--tc-danger-soft--tc-danger-on-softbg-danger-solidtext-danger-on-solidbg-danger-softtext-danger-on-soft
--tc-info-solid--tc-info-on-solid--tc-info-soft--tc-info-on-softbg-info-solidtext-info-on-solidbg-info-softtext-info-on-soft
--spacing-control-xs--spacing-control-sm--spacing-control-md--spacing-control-lg--spacing-control-xlh-control-xsh-control-smh-control-mdh-control-lgh-control-xl
--spacing-toggle-xs--spacing-toggle-sm--spacing-toggle-md--spacing-toggle-lg--spacing-toggle-xlsize-toggle-xssize-toggle-smsize-toggle-mdsize-toggle-lgsize-toggle-xl
--spacing-icon-xs--spacing-icon-sm--spacing-icon-md--spacing-icon-lg--spacing-icon-xlsize-icon-xssize-icon-smsize-icon-mdsize-icon-lgsize-icon-xl
--spacing-pad-x-xs--spacing-pad-x-sm--spacing-pad-x-md--spacing-pad-x-lg--spacing-pad-x-xlpx-pad-x-xspx-pad-x-smpx-pad-x-mdpx-pad-x-lgpx-pad-x-xl
--spacing-pad-y-xs--spacing-pad-y-sm--spacing-pad-y-md--spacing-pad-y-lg--spacing-pad-y-xlpy-pad-y-xspy-pad-y-smpy-pad-y-mdpy-pad-y-lgpy-pad-y-xl
--tc-radius--radius-box--radius-chiprounded-controlrounded-boxrounded-chip
--tc-font-sans--tc-font-monofont-sansfont-mono

Overriding a token

Set the variable after the three imports. Nothing checks the contrast of a value you set yourself.

app/globals.css, version 2
@import "topclassui/styles.css";

:root {
  --tc-primary-solid: var(--color-emerald-700);
  --tc-primary-on-solid: var(--color-white);
  --tc-primary-on-soft: var(--color-emerald-700);
  --tc-radius: 0.75rem;
}

If the order is wrong

Tailwind’s layer order is set by the first import. Open a layer before it and the components lose to the base resets.

Wrong
@import "topclassui/styles.css";
@import "tailwindcss";

/* the components layer is opened before Tailwind's layer
   order statement, so it sinks below base and the resets win */
Right
@import "tailwindcss";
@import "topclassui/tokens.css";
@import "topclassui/styles.css";

On Vite

On Vite, the same three lines apply, with @tailwindcss/vite in the plugin list instead of PostCSS. The config is on Install the package.

NextProvider