Skip to content

Do not export useTheme hook #20482

@miroslavstastny

Description

@miroslavstastny

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:

  1. FluentProvider uses that hook internally to merge themes in a nested provider. This use case requires the raw token values.
  2. 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.

Metadata

Metadata

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions