Is there a recommended way to set up theming with Griffel? #111
-
Is there a recommended way to set up theming with Griffel?Wondering what your thoughts are on dynamic theming (e.g. dark / light) with Griffel. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey, We decided to not build anything into Griffel itself for styling to avoid restrictions and limitations. I think that the best approach for styling nowadays is CSS variables (and it's what we picked for Fluent UI React v9 aka I made an example on CodeSandbox that could be useful (https://codesandbox.io/s/xenodochial-star-ob7oxt?file=/src/App.tsx). There are three pieces:
This approach is not restricted to Griffel and can used with other CSS in JS libraries. |
Beta Was this translation helpful? Give feedback.
Hey,
We decided to not build anything into Griffel itself for styling to avoid restrictions and limitations. I think that the best approach for styling nowadays is CSS variables (and it's what we picked for Fluent UI React v9 aka
@fluentui/react-components
) and it's what I can recommend for moving forward.I made an example on CodeSandbox that could be useful (https://codesandbox.io/s/xenodochial-star-ob7oxt?file=/src/App.tsx). There are three pieces:
lightTheme
,darkTheme
)Proxy
fortokens
: you can enumerate tokens manually, but it's will be really boring process