How can I extend success, error, info, and warning toast methods to include an icon before the message? #3538
Unanswered
Josh-Nicholson
asked this question in
Q&A
Replies: 1 comment
-
Hi Josh, As far as I can tell, the Skeleton Toast system is intended to just display simple text. I don't think you can inject html or a Svelte component into Toasts. Have you considered https://svelte-french-toast.com as suggested in the Alternatives Section? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there 👋
In Skeleton v2, I used a custom ToastMaker.ts helper like this:
I want to achieve the same functionality in Skeleton v3 by extending toast.success, toast.error, etc. so that an icon is always inserted before the message without having to manually add the icon every time I call it.
I'm using Iconify via unplugin-icons, so ideally I want to inject an icon component or HTML snippet in a reusable way whenever one of those methods is called.
Is there a recommended pattern for extending or wrapping the built-in toast methods globally to add custom content like icons?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions