Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update doc to reflect setTheme function change #32490

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "docs: reflect setTheme change",
"packageName": "@fluentui/web-components",
"email": "machi@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ import { webLightTheme } from '@fluentui/tokens';
setTheme(webLightTheme);
```

If you need to set token values for an element which is not the document body, you can use `setThemeFor` and pass an element followed by the theme.
If you need to set token values for an element which is not the document body, you can pass in the element as the second argument in `setTheme`.

```js
import { setThemeFor } from '@fluentui/web-components';
import { webLightTheme } from '@fluentui/tokens';
import { setTheme } from '@fluentui/web-components';
import { webDarkTheme } from '@fluentui/tokens';

const el = document.getElementById('my-element');

setThemeFor(el, webLightTheme);
setTheme(webDarkTheme, el);
```

### Do not use CSS variables directly
Expand Down
Loading