Different between @fluentui/merge-styles and @griffel #22924
-
Excuse me, I have a question about @fluentui/merge-styles and @griffel. Both of them are Css-in-JS.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Griffel uses atomic CSS, intentionally does not allow any props or state to be used in style computations (you only use props and state to conditionally merge and apply the resulting classes). For theming, instead of generating different styles/classes for different themes, Griffel uses CSS variables (therefore no IE11 support) for theme tokens and always produces the same styles regardless the theme. With this approach:
You can use both in your project, you can run them side by side, but you should not mix both to generate classes for a single DOM element. |
Beta Was this translation helpful? Give feedback.
merge-styles
is used in FUI v8, it will be replaced bygriffel
in the upcoming FUI v9.Griffel uses atomic CSS, intentionally does not allow any props or state to be used in style computations (you only use props and state to conditionally merge and apply the resulting classes). For theming, instead of generating different styles/classes for different themes, Griffel uses CSS variables (therefore no IE11 support) for theme tokens and always produces the same styles regardless the theme.
With this approach: