Skip to main content
Twenty UI components read public CSS custom properties prefixed with --t-. Prefer semantic tokens such as background.secondary and font.color.primary when styling your own components; these values adapt to the active palette.

Use tokens in styles

themeCssVariables maps token paths to CSS variable references. Use it for values that CSS resolves:
The equivalent CSS uses variables directly:

Read resolved values

useTheme() reads the active provider’s computed tokens. Use it when a component expects a JavaScript number, such as an icon size. The provider needs the theme stylesheet to be loaded in the browser to resolve CSS variables.
Every entry in themeCssVariables is a CSS reference string, including numeric tokens. Do not perform arithmetic on those strings. On the server, resolved browser values are unavailable; see Server rendering.

Scope an override

Pass applyToRoot={false} to apply a theme to a subtree. Override public CSS variables by their full name:
A scoped provider adds a wrapper with display: contents; it does not create a layout box. It also supplies a container for components that support themed portals. Portals created by other libraries need their own container configuration. Variables prefixed with --tw- are private component details. Use public props and --t- tokens instead of depending on those variables. See the token reference for the available names and palette values.