Skip to content
Zaib Azhar

Blog4 min read

How I Built a White-Label Theme Without Forking the UI for Every Client

I share how I stopped white-label brands from needing their own CSS forks by moving brand differences into a small theme token layer that one shared UI could consume.

Illustration of one shared travel booking interface connected to three differently branded white-label themes through a central design-token core.
One shared UI powered by theme tokens, instead of a separate CSS fork for every white-label client.

While working on white-label products across commerce and travel, I kept running into the same frontend problem: every new client wanted their own brand colours, buttons, and accents, and the fastest short-term answer was usually a new CSS fork.

At first that looked manageable. One client needed a blue primary button. Another needed orange. A third wanted a darker header and different focus rings. So the codebase slowly collected client-specific stylesheets and class overrides.

The short-term CSS fork

Something like this started to appear:

css
.btn-primary {
  background: #0b5fff;
}

.client-a .btn-primary {
  background: #0b5fff;
}

.client-b .btn-primary {
  background: #ff7a00;
}

.client-c .btn-primary {
  background: #0f9f6e;
}

This worked for the first couple of brands. Then product changes started landing on the shared booking or checkout UI. A button padding update, a hover state fix, or an accessibility contrast tweak had to be checked across every client override. The shared interface was no longer really shared.

That is when I moved the brand differences into a theme layer instead of forking the UI.

One component tree, many brands

The idea was simple: keep one component tree and one layout system, then let each client provide values for the things that actually change between brands.

I started with CSS custom properties for the brand tokens:

css
:root {
  --color-primary: #0b5fff;
  --color-primary-foreground: #ffffff;
  --color-surface: #ffffff;
  --color-border: #e5e7eb;
  --radius-button: 8px;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-primary-foreground);
  border-radius: var(--radius-button);
}

Now the button component always reads from tokens. The brand no longer needs its own button CSS file. It only needs a different token set.

For each client theme, I overrode the variables once:

css
[data-theme='ocean'] {
  --color-primary: #0b5fff;
  --color-primary-foreground: #ffffff;
  --radius-button: 8px;
}

[data-theme='sunset'] {
  --color-primary: #ff7a00;
  --color-primary-foreground: #111111;
  --radius-button: 999px;
}

[data-theme='forest'] {
  --color-primary: #0f9f6e;
  --color-primary-foreground: #ffffff;
  --radius-button: 6px;
}

Then the app shell only had to set the active theme on a root element, for example data-theme="sunset" on html or the main layout wrapper. Every shared component underneath picked up the brand automatically.

What belongs in the theme

This also forced a useful product decision: what should be themeable, and what should stay shared?

Here are some of the tokens I ended up treating as brand-owned:

Token area

Why it belonged in the theme

Primary and accent colours

These are the strongest brand signals

Button radius and focus ring

Small visual identity details without layout forks

Surface and border colours

Cards and panels need to match the brand canvas

Font family for brand UI

Only when the client had a licensed brand face

And here is what I deliberately kept out of the theme layer:

Keep shared

Why

Spacing scale

Layout rhythm should stay consistent across clients

Component structure

One booking card, one checkout step, one form pattern

Interaction behaviour

Validation, loading, and focus order stay product decisions

Breakpoints

Responsive behaviour belongs to the system, not the brand pack

That boundary mattered. If everything becomes a token, you recreate the same fork problem inside configuration. If nothing becomes a token, every brand still needs custom CSS.

What improved in practice

A practical example was the primary call-to-action across a multi-product flow. Before tokens, each brand had its own button overrides in different files. After tokens, the same button component rendered correctly for every client because it only consumed var(--color-primary) and related theme values.

Onboarding a new brand also became much lighter. Instead of copying stylesheets and hunting for hardcoded colours, we created a theme pack: token values, logo assets, and any licensed fonts. The shared UI stayed untouched.

I still needed escape hatches in a few places. A client-specific promo banner or a one-off landing module can justify local styling. But those exceptions stayed at the edges. The core product UI remained one system.

Start with a small token set

For any product that serves multiple brands from the same frontend, I would strongly recommend starting with a small token set instead of client CSS forks. It keeps the UI reusable, makes brand onboarding faster, and stops every visual tweak from becoming a multi-theme maintenance problem.

Useful references