You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
When nesting themes, child themes do not inherit unspecified tokens from a parent theme #2002
According to StyleX documentation, when nesting themes, a child theme would inherit unspecified tokens from the parent theme if they are overridden in the parent theme. In practice however, it inherits unspecified tokens from the original var group instead.
Expected behavior
A nested child theme should inherit unspecified tokens from the parent theme if they are overridden in the parent theme.
Steps to reproduce
Define a variable group in a separate .stylex.ts file:
changed the title [-]When nesting themes, child themes do not inherit unspecified tokens from a parent theme[/-][+]When nesting themes, child themes do not inherit unspecified variables from a parent theme[/+]on Nov 2, 2026
changed the title [-]When nesting themes, child themes do not inherit unspecified variables from a parent theme[/-][+]When nesting themes, child themes do not inherit unspecified tokens from a parent theme[/+]on Nov 2, 2026
Root cause: createTheme returns `${overrideClass} ${varGroupHash}` as the class, and defineVars emits its defaults under :root, .${varGroupHash}. So the child element also gets the var group class, which re-declares every default at that level and shadows what the parent theme set. The override class only declares the tokens you pass, so it's the group class that resets the rest.
Two options: drop varGroupHash from the theme's class value (it's still the key props merges on, so one theme per group still wins), or keep it and fix the "Partial overrides" section of the docs. Is the group class there on purpose, e.g. for vars used outside :root? Happy to send a PR for whichever you prefer.
Activity
[-]When nesting themes, child themes do not inherit unspecified tokens from a parent theme[/-][+]When nesting themes, child themes do not inherit unspecified variables from a parent theme[/+][-]When nesting themes, child themes do not inherit unspecified variables from a parent theme[/-][+]When nesting themes, child themes do not inherit unspecified tokens from a parent theme[/+]kgeminicdev commentedon Nov 2, 2026
Root cause:
createThemereturns`${overrideClass} ${varGroupHash}`as the class, anddefineVarsemits its defaults under:root, .${varGroupHash}. So the child element also gets the var group class, which re-declares every default at that level and shadows what the parent theme set. The override class only declares the tokens you pass, so it's the group class that resets the rest.Two options: drop
varGroupHashfrom the theme's class value (it's still the keypropsmerges on, so one theme per group still wins), or keep it and fix the "Partial overrides" section of the docs. Is the group class there on purpose, e.g. for vars used outside:root? Happy to send a PR for whichever you prefer.