Is there a way to pass properties to custom components?
Closed this issue · 4 comments
enyo commented
The docs show this:
import HeadlessToast from './HeadlessToast.svelte'
toast.custom(HeadlessToast)
But in the example provided, what if I want the time + description to be provided to the HeadlessToast
component? Is that possible?
enyo commented
I've looked at the source and found this:
{#if toast.component}
<svelte:component this={toast.component} on:closeToast={deleteToast}></svelte:component>
{:else ...}
so it doesn't seem to be possible to provide data.
How about adding an additional configuration option here:
svelte-sonner/src/lib/types.ts
Lines 15 to 20 in 6ed9173
I would suggest componentProps
. This could then be applied to <svelte:component
when instantiating.
@wobsoriano does this sound good to you? If so, I can create a PR.
wobsoriano commented
Hey, will take a look tomorrow. Thanks!
wobsoriano commented
Fixed in #22