Skip to content

Question: themes and components #265

Answered by nmn
edamascus asked this question in Q&A
Dec 27, 2023 · 1 comments · 9 replies
Discussion options

You must be logged in to vote

A theme can be passed around exactly like styles.

what is the theme type...

The type for a theme is Theme.

Assuming you have a VarGroup called colors, a theme for that varGroup has the type Theme<typeof colors>.

...or do I have to pass the theme name instead?

You pass the reference to theme. There are no "names" or magic strings in StyleX. Everything works by reference.

Should I be able to create a theme in the consumer project based on the theme variables defined in the library and pass it somehow to the component?

Yes, a consumer can import varGroup objects, create their own themes and pass them in where a Theme<typeof varGroup> is expected.

Will this "overriding" work for descen…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@nmn
Comment options

@peter-85
Comment options

@edamascus
Comment options

@peter-85
Comment options

@edamascus
Comment options

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
4 participants
Converted from issue

This discussion was converted from issue #264 on December 27, 2023 10:20.