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
"fonts": "@font-face { font-family: \"Custom Font Name\"; src: url(\"https://...\"); }"
466
474
}
467
475
},
468
476
"displayMode": "inline",
@@ -587,16 +595,46 @@ type McpUiStyleVariableKey =
587
595
...
588
596
}
589
597
```
590
-
- 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
591
-
- 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
598
+
- Apps can use the `applyHostStyleVariables` utility (or `useHostStyleVariables` if they prefer a React hook) to easily populate the host-provided CSS variables into their style sheet
599
+
- 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
592
600
593
601
Example usage of standardized CSS variables:
594
602
595
603
```css
596
604
.container {
597
605
background: var(--color-background-primary);
598
606
color: var(--color-text-primary);
599
-
font: var(--font-style-body);
607
+
font-family: var(--font-sans);
608
+
}
609
+
```
610
+
611
+
#### Custom Fonts
612
+
613
+
Hosts can provide custom fonts via `styles.css.fonts`, which can contain `@font-face` rules for self-hosted fonts, `@import` statements for font services like Google Fonts, or both:
614
+
615
+
```typescript
616
+
// Self-hosted fonts
617
+
hostContext.styles.css.fonts=`
618
+
@font-face {
619
+
font-family: "Custom Font Name"; // Name should match the font name used in a font variable (`--font-sans`, `--font-mono`)
0 commit comments