Skip to main content

Reset Theme

The stylex.defineVars function is used to create a set of CSS variables, called VarGroups. Further, the stylex.createTheme function can be used to create Themes, that override the values of the variables defined within VarGroups.

Themes in StyleX are mutually exclusive and do not merge. Any variable that is not explicitly overridden in a Theme is set to its default value.

This characteristic of Themes can be used to define a "empty" theme that resets all variables to their default values.

Example

import * as stylex from '@stylexjs/stylex';
import { vars } from './variables.stylex';

export const resetVars = stylex.createTheme(vars, {});