Skip to content

Commit

Permalink
update doc to reflect setTheme function change (#32490)
Browse files Browse the repository at this point in the history
  • Loading branch information
marchbox authored Sep 10, 2024
1 parent 01cacb0 commit 269f109
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
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

0 comments on commit 269f109

Please sign in to comment.