You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> 💡 All theme variants must provide a value for every variable or it’s a type error.
383
391
384
-
### createThemeVars
392
+
### createThemeContract
393
+
394
+
Creates a contract for themes to implement.
385
395
386
-
Creates a collection of CSS Variables without coupling them to a specific theme variant.
396
+
**Ensure this function is called within a `.css.ts` context, otherwise variable names will be mismatched between themes.**
387
397
388
398
> 💡 This is useful if you want to split your themes into different bundles. In this case, your themes would be defined in separate files, but we'll keep this example simple.
Copy file name to clipboardExpand all lines: docs/treat-migration-guide.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,32 +72,32 @@ module.exports = {
72
72
If you only have a single theme, you can keep things simple by using `createGlobalTheme` and targeting `:root`. If you do this, your variables will just work without having to wire anything up to the document.
If you have multiple themes, or if you want to avoid the global scope, use the [`createTheme`](https://github.com/seek-oss/vanilla-extract#createtheme) function instead.
If you're bundle-splitting your themes, you'll probably want the [`createThemeVars`](https://github.com/seek-oss/vanilla-extract#createthemevars) function.
100
+
If you're bundle-splitting your themes, you'll probably want the [`createThemeContract`](https://github.com/seek-oss/vanilla-extract#createthemecontract) function.
101
101
102
102
## `TreatProvider`
103
103
@@ -234,10 +234,10 @@ To get access to variables, we now import theme variables from the `.css.ts` fil
Since this calculation is not yet supported natively in CSS, this lighter background would need to become part of your theme definition. In this case, we'll introduce a new `color` variable called `brandLight`. Notice that in this context we're able to execute arbitrary JavaScript code.
0 commit comments