Theming
Theming is CSS: you set custom properties, and the grid, the appearance axes and the recipes read them. The vocabulary (which names exist) belongs to the layout theme; the values belong to your stylesheet.
The properties you override
| Group | Properties | Read by |
|---|---|---|
| Gap tokens | --se-grid-gap-none, --se-grid-gap-compact, --se-grid-gap-default, --se-grid-gap-loose, --se-grid-gap-wide | Every grid: step grids, fieldsets, array rows |
| Size hooks | --se-space-compact, --se-space-comfortable, --se-control-height-compact, --se-control-height-comfortable | The built-in size axis, for compact and comfortable |
| Axis tokens | --se-space, --se-font-size, --se-measure, --se-control-height, --se-border-width, --se-shadow, --se-surface-background | Card shells read all but --se-font-size; the hero, split screen, sidebar and stack shells read --se-space; controls read --se-control-height; a field that carries a size pick reads --se-font-size (both renderers) |
| Colour roles | --primary with --on-primary (Radiant UI) or --primary-foreground (shadcn), --border, --surface, and the rest of your design system | Radiant UI and shadcn components, and the card shells |
| Item placement | --se-item-*, --se-item-display-mode | Field hosts; see Layout themes |
A card shell keeps the look of an unstyled card as the fallback of each token it reads (var(--se-space, 1.5rem)), so with no token set it looks as it does without a theme.
A colour that every entity of your domain has for itself (a colour per machine, per brand) is data, not a theme setting: write your own data-<domain> attribute and set the colour roles from it in your stylesheet. Identity tokens shows the pattern.
Where to set a token
Custom properties inherit, so most tokens can be set on any element above the one that reads them. The rule for the size hooks is one line: set them on :root, on any ancestor of the form or on the form's own className, which works the same in both renderers for a pick on the card shell, a step or a field. The table says what else works.
| Token | Set it on | Why |
|---|---|---|
Gap tokens --se-grid-gap-* | :root, a wrapper, or the form's className | The theme never declares them on an element, so an inherited value always reaches the grid. |
Size hooks --se-space-*, --se-control-height-* | :root, any ancestor of the form, or the form's own className | The axis rule reads the hook where the pick sits, and the pick inherits it. A hook you set always wins: in Radiant, the theme's own value sits in a --se-renderer-* fallback (set by renderers, not by apps) that the hook outranks, so a value set above the form is not replaced. The nearest setting wins, so a class on the form beats :root. |
Axis tokens with a literal value (--se-font-size, --se-measure) | A rule with class specificity on the element that carries the pick: .my-form [data-se-size='compact'] { ... } | The axis rule declares them on that element, and it is closer than anything above. With no pick they are not declared, so the form's className works. |
| Colour roles | :root, or a class on the form | They are your design system's variables; a host axis can set them per value. |
The token rules (the tokens an axis value sets) sit inside :where(), so a class of yours wins over them when it targets the same element, with no !important. The grid and item rules do not: .se-grid[data-se-theme="<id>"] and .se-grid-item[data-se-theme="<id>"] outrank a lone class. Change layout through the --se-grid-* and --se-item-* properties, and use --se-item-display-mode to give an item its own display, rather than overriding display or grid-column with a class.
A host override of a gap token replaces it at every width, including a width the theme ramps through grid.responsive: the public token is the first var() argument and a ramp only changes the fallback. A host that wants its own rhythm per width declares its own media queries.
Radiant: the spacing tokens of its own theme
Radiant UI computes --size-control-sm, --size-control-md and --size-control-lg on :root in its default spacing pack, for example --size-control-md: calc(2rem * var(--rui-density)). A custom property that holds a var() is resolved where it is declared and inherited as the resolved value, so setting --rui-density on a wrapper does not resize the controls below it: they keep the size computed from the :root density.
To make a region denser, set the tokens on the wrapper too:
.dense-region {
--rui-density: 0.8;
--size-control-sm: calc(1.75rem * var(--rui-density));
--size-control-md: calc(2rem * var(--rui-density));
--size-control-lg: calc(2.25rem * var(--rui-density));
}size: compact and size: comfortable map onto --size-control-sm and --size-control-lg, so a region with a Radiant UI theme of its own needs these tokens redeclared, as above. Prefer the size hooks above for form controls, and Radiant UI's token packs (@ecopages/radiant-ui/tokens/spacing/compact) when the whole app should change density.
React: the registry controls
The recipe styles and the controls styles are two imports with different jobs:
recipes.cssis imported into thecomponentslayer, so your Tailwind utilities and classes sit above it. Its rules are:where(), so any class beats them.controls.cssis imported unlayered, afterrecipes.css; Import the styles says why. It lets--se-control-heightset the height of controls that carrydata-se-control, and gives a field that carries asizepick the font size--se-font-size. While a size is picked, a Tailwind height utility you pass to a control and a text utility you pass to a field lose to it; with no pick, ordefault, they keep their size. An unlayered class of yours always wins.
See Forms React getting started for the two import lines.
A complete theme file
One stylesheet can theme every form that carries className: 'acme': rhythm, the size hooks, the colour roles and the literal tokens of two axis values. The forms pick size: comfortable and surface: outlined, so the file exercises all four groups. The gap tokens, colour roles and size hooks also work from :root. The rules in the last two blocks target the elements that carry the picks.
.acme {
/* 1. Rhythm: the gap tokens every grid reads. */
--se-grid-gap-compact: 0.5rem;
--se-grid-gap-default: 1rem;
--se-grid-gap-loose: 1.75rem;
--se-grid-gap-wide: 2.5rem;
/* 2. The hooks the built-in size axis reads. */
--se-space-compact: 0.75rem;
--se-space-comfortable: 2.25rem;
--se-control-height-compact: 2rem;
--se-control-height-comfortable: 2.75rem;
/* 3. Colour roles of your design system: Radiant UI and shadcn components read them. */
--primary: #4f46e5;
--on-primary: #ffffff;
}
/* 4. Literal tokens of an axis value: set them on the element that carries the pick. */
.acme [data-se-size='comfortable'] {
--se-measure: 36rem;
}
.acme [data-se-surface='outlined'] {
--se-border-width: 2px;
}The themed form example is a smaller file of the same kind with a live demo, and it builds the colour roles from a host axis instead of setting them in the stylesheet.