Skip to content

Commit 26d4ed2

Browse files
committed
Update custom font docs
1 parent dd0202c commit 26d4ed2

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

README.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -156,31 +156,39 @@ Toast messages can be in rich HTML too - for example:
156156

157157
```js
158158
// Definitely not spam
159-
toast.push('<strong>You won the jackpot!</strong><br>Click <a href="#" target="_blank">here</a> for details! 😛')
159+
toast.push(`<strong>You won the jackpot!</strong><br>
160+
Click <a href="#" target="_blank">here</a> for details! 😛`)
160161
```
161162

162163
### Custom Fonts
163164

164-
Apply custom font CSS on toast messages by setting styles globally on the `._toastMsg` class:
165+
In a Svelte app, the easiest way to apply custom font styles is to wrap the toast container
166+
then apply styles on the wrapper:
165167

166168
```html
167169
<style>
168-
/* In Svelte app, use the `:global` modifier */
169-
:global(._toastMsg) {
170-
font-family: Roboto, sans-serif;
171-
font-size: 0.875rem;
172-
font-weight: 300;
173-
line-height: 1.125;
174-
}
175-
:global(._toastMsg>strong) {
176-
font-weight: 600;
177-
}
170+
.wrap {
171+
font-family: Roboto, sans-serif;
172+
font-size: 0.875rem;
173+
...
174+
}
175+
.wrap :global(strong) {
176+
font-weight: 600;
177+
}
178+
</style>
178179

179-
/* For any others, just apply globally */
180+
<div class="wrap">
181+
<SvelteToast />
182+
</div>
183+
```
184+
185+
In Vanilla JS, simply apply your styles to the `._toastMsg` class:
186+
187+
```css
180188
._toastMsg {
189+
font-family: Roboto, sans-serif;
181190
...
182191
}
183-
</style>
184192
```
185193

186194
## Options

0 commit comments

Comments
 (0)