Do not export useTheme hook in react-components
useTheme hook currently returns raw token values. For encapsulation purposes, it should return CSS variables instead.
There used to be two different use cases for the useTheme hook:
FluentProvider uses that hook internally to merge themes in a nested provider. This use case requires the raw token values.
- partner application needs to use the theme tokens.
The first use case is still valid.
For the second use case, the hook is no longer necessary after #20900 is done.
The application can either import the tokens directly from the theme - those will reference the CSS variables injected by FluentProvider - or in case of SASS use the SASS tokens implemented in #20808 which use the same CSS variables.
Do not export
useThemehook inreact-componentsuseThemehook currently returns raw token values.For encapsulation purposes, it should return CSS variables instead.There used to be two different use cases for the
useThemehook:FluentProvideruses that hook internally to merge themes in a nested provider. This use case requires the raw token values.The first use case is still valid.
For the second use case, the hook is no longer necessary after #20900 is done.
The application can either import the tokens directly from the theme - those will reference the CSS variables injected by
FluentProvider- or in case of SASS use the SASS tokens implemented in #20808 which use the same CSS variables.