Hello CDS + Tailwind
Click me
```
Once this is set up, you get both at the same time:
- standard Tailwind utilities: `flex`, `font-bold`, `gap-3`, `p-4`
- utility classes built from CDS tokens: `bg-surface-primary`, `text-content-primary`, `rounded-200`
- typography on the CDS scale: `font-sans` (the design system font), sizes
`text-50`…`text-1100`, line heights `leading-50`…`leading-1100`, weights
`font-regular` / `font-bold`, tracking `tracking-500`. Size and line height are
separate utilities: `text-*` never touches `line-height`
Write spacing with the standard Tailwind numeric scale (`gap-2`, `p-4`,
`mt-2`): the CDS spacing scale matches it, so there is no need for
`gap-200`/`p-400`-style spacing classes. Token-based classes remain for
color, radius, and typography.
The CDS configuration stays in sync with the active CDS theme automatically, so
color utility classes switch along with the theme.
---
---
sourceHash: 099fbd8735b578ab40ec1e171e04b7c65a1f70b9
---
# Theming
The design system lets you switch themes or configure your own theme
programmatically, including at runtime.
## How it works
A theme in CDS 4 is a set of **semantic tokens** that are turned into CSS
variables when the application starts:
```
ThemeDefinition (TS) → --cds-color-* / --cds-* (CSS variables) → component styles
↓
@theme (Tailwind CSS v4) → bg-surface-primary, rounded-200, …
```
The variables hold **finished colors**, exactly as they are written in the
theme. The built-in themes write colors in `oklch()`. Opacity on top of a token
is set with `color-mix()`:
```css
/* generated by CDS */
:root {
--cds-color-brand-primary: oklch(57.4% 0.16 254.98);
--cds-color-surface-primary: oklch(100% 0 0);
--cds-spacing-400: 1rem;
--cds-border-radius-200: 0.25rem;
}
/* usage */
.my-block {
background: var(--cds-color-surface-primary);
border: var(--cds-border-100) solid color-mix(in srgb, var(--cds-color-brand-primary) 40%, transparent);
padding: var(--cds-spacing-400);
}
```
> In CDS 3 and early CDS 4 builds the variables held RGB channels and a color
> was read as `rgb(var(--cds-color-x))`. That no longer works — see the
> migration guide.
Theme styles are injected into `
```
Every `