Skip to content
Discussion options

You must be logged in to vote

This is definitely possible. Any vars (tokens) you create, whether that be with createVar, createThemeContract, or other APIs, are just strings. They can safely be exported from a .css.ts file and used within other styles (.css.ts files) or even at runtime in your components, just like how styles created with the style function are compiled away, but can still be referenced via their classname string (this is what ends up being exported in your .css.ts file).

As a small suggestion, I'd advise against exposing your tokens via a hook, if possible. Unless there's a specific reason you need to use a hook, a simpler approach could just be to document an exported vars or tokens object in your p…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@thedanchez
Comment options

@askoufis
Comment options

@thedanchez
Comment options

@askoufis
Comment options

Answer selected by thedanchez
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