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
Hosts pass CSS custom properties via `HostContext.styles` for visual cohesion with the host environment.
468
+
Hosts can optionally pass CSS custom properties via `HostContext.styles` for visual cohesion with the host environment.
472
469
473
-
#### Standardized Variables
470
+
#### Current Standardized Variables
474
471
475
472
| Category | Variables |
476
473
|----------|-----------|
@@ -489,26 +486,27 @@ Hosts pass CSS custom properties via `HostContext.styles` for visual cohesion wi
489
486
490
487
#### Host Behavior
491
488
492
-
- Hosts MAY provide any subset of standardized variables
493
-
- Hosts MAY use CSS `light-dark()` function for theme-aware values
494
-
-`theme` indicates the active mode; `styles` provides the concrete CSS values
489
+
- Hosts can provide any subset of standardized variables, or not pass `styles` at all. However, passing all of the standardized properties is recommended for cohesiveness
490
+
- Hosts can use the CSS `light-dark()` function for theme-aware values
495
491
496
492
#### App Behavior
497
493
498
-
- Apps SHOULD use fallback values for CSS variables: `var(--color-text-primary, #171717)`
499
-
- This ensures graceful degradation when hosts omit `styles` or specific variables
500
-
- When the host uses `light-dark()` values, apps MUST set `color-scheme` on their document:
501
-
```css
502
-
:root { color-scheme: lightdark; }
503
-
```
494
+
- Apps should set default fallback values for CSS variables, to account for hosts who don't pass some or all style variables. This ensures graceful degradation when hosts omit `styles` or specific variables:
495
+
```
496
+
:root {
497
+
--colorTextPrimary: #171717;
498
+
}
499
+
```
500
+
- Apps can use the `applyHostStyles` utility (or `useHostStyles` if they prefer a React hook) to easily populate the host-provided CSS variables into their style sheet
501
+
- Apps can use the `applyDocumentTheme` utility (or `useDocumentTheme` if they prefer a React hook) to easily respond to Host Context `theme` changes in a way that is compatible with the host's light/dark color variables
0 commit comments