Skip to content

Commit 5923fc0

Browse files
committed
Add demo for user-defined classes feature
1 parent 97bcf20 commit 5923fc0

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

docs/App.svelte

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ toast.set(id, { next: 1 })`,
192192
run: async () => {
193193
colors = false
194194
bottom = false
195-
options = { reversed: false, intro: { x: 256 } }
195+
options = {}
196196
await tick()
197197
toast.push('All themes reset!')
198198
}
@@ -300,11 +300,41 @@ toast.pop(0)`,
300300
}
301301
})
302302
}
303+
},
304+
{
305+
name: 'STYLE WITH USER-DEFINED CLASSES',
306+
code: `<style>
307+
:global(.custom) {
308+
--toastBackground: #4299E1;
309+
--toastBarBackground: #2B6CB0;
310+
}
311+
</style>
312+
313+
<script>
314+
toast.push('Styled with custom class', { classes: ['custom'] })
315+
<\/script>
316+
317+
<SvelteToast />`,
318+
run: async () => {
319+
const opts = options
320+
options = { ...options, classes: ['merge1'] }
321+
await tick()
322+
toast.push('Styled with custom class', {
323+
classes: ['custom', 'merge2'],
324+
onpop: () => {
325+
options = opts
326+
}
327+
})
328+
}
303329
}
304330
]
305331
</script>
306332

307333
<style>
334+
:global(.custom) {
335+
--toastBackground: #4299e1;
336+
--toastBarBackground: #2b6cb0;
337+
}
308338
.colors {
309339
--toastBackground: rgba(245, 208, 254, 0.95);
310340
--toastColor: #424242;

0 commit comments

Comments
 (0)