Skip to content

Conversation

@anwarulislam
Copy link

@anwarulislam anwarulislam commented May 6, 2024

This PR adds support for multiple actions.

Example:

 toast.message('Event has been created', {
  action: [
    {
      label: 'Cancel',
      onClick: (e, toast) => toast.deleteToast(200)
    },
    {
      label: 'Confirm',
      onClick: () => console.log('Confirm')
    }
  ],
  duration: 10000000
})

Added new callback parameter in onClick function which through we can now pass the deleteToast function. And call it if it's needed. The function accepts delay as parameter to delete the toast.

@vercel
Copy link

vercel bot commented May 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
vue-sonner ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2024 10:36pm

@anwarulislam
Copy link
Author

@xiaoluoboding any thought about this?

@Cannonb4ll
Copy link

This would be a very welcoming addition! 🙌

@ArtusLama
Copy link

Would love this feature. But I think the spacing should be adjusted since the button are very far from each other.

@gespinha
Copy link

@xiaoluoboding any plans to get this implemented soon? This feature is still a huge miss in this package, but this PR is here hanging with a fix complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants