Closed prests closed 1 week ago
There is a small mistake. The stylex.types.color()
function should be outside the entire object of possible values:
See: https://stackblitz.com/edit/sb1-tu4v6l?file=src%2Fvariables.stylex.ts
export const themeTokens = stylex.defineVars<ThemeTokens>({
color_action_background_primary: stylex.types.color({
default: 'black',
[DARK]: 'white',
}),
color_action_background_primary_hover: stylex.types.color({
default: 'grey' as string,
[DARK]: 'white' as string,
}),
color_action_text_primary: stylex.types.color({
default: 'white' as string,
[DARK]: 'black' as string,
}),
});
This is to ensure that all values for a variable have the same type.
Describe the issue
Full transparency I'm not sure if this is a stylex bug or vite-plugin-stylex but lets start here and go from there!
I'm new to stylex and I'm trying to use stylex to create a token system using stylex's variables, but I'm running into issues utilizing stylex's variable types within defineVars. I'm being told the the default values for my variables are not defined
Expected behavior
I'd expect default for my variables to be defined.
Steps to reproduce
Example:
Types File
variables file
component
Test case
I tried using the Next + Stylex playground on the docs page but honestly wasn't seeing any of my variables being applied. I'm not a Next user so apologies if I just missed something simple.
https://stackblitz.com/edit/stylex-next-g5wmio?file=app%2Fpage.tsx
If anyone can point out what I'm doing wrong to even setup a basic variable here I will update it to show the full issue I'm having.
Additional comments
No response