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.
471
+
Hosts can optionally pass CSS custom properties via `HostContext.styles` for visual cohesion with the host environment.
475
472
476
-
#### Standardized Variables
473
+
#### Current Standardized Variables
477
474
478
475
| Category | Variables |
479
476
|----------|-----------|
@@ -492,26 +489,27 @@ Hosts pass CSS custom properties via `HostContext.styles` for visual cohesion wi
492
489
493
490
#### Host Behavior
494
491
495
-
- Hosts MAY provide any subset of standardized variables
496
-
- Hosts MAY use CSS `light-dark()` function for theme-aware values
497
-
-`theme` indicates the active mode; `styles` provides the concrete CSS values
492
+
- 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
493
+
- Hosts can use the CSS `light-dark()` function for theme-aware values
498
494
499
495
#### App Behavior
500
496
501
-
- Apps SHOULD use fallback values for CSS variables: `var(--color-text-primary, #171717)`
502
-
- This ensures graceful degradation when hosts omit `styles` or specific variables
503
-
- When the host uses `light-dark()` values, apps MUST set `color-scheme` on their document:
504
-
```css
505
-
:root { color-scheme: lightdark; }
506
-
```
497
+
- 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:
498
+
```
499
+
:root {
500
+
--colorTextPrimary: #171717;
501
+
}
502
+
```
503
+
- 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
504
+
- 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