Skip to content
Discussion options

You must be logged in to vote

You can set the values in a defineVars call to null and then only define their values with createTheme. You will need to use more type annotations though.

export const myVars = stylex.defineVars({
  primary: null as null | string,
  secondary: null as null | string,
});
export const blueTheme = stylex.createTheme(myVars, {
  primary: 'blue',
  secondary: 'grey',
});

Now the variables will not be defined for :root.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

nmn
Sep 4, 2024
Collaborator

You must be logged in to vote
0 replies
Answer selected by nmn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants