Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow to pass custom elements to title and description #502

Merged
merged 2 commits into from
Nov 2, 2024

Conversation

emilkowalski
Copy link
Owner

You can render custom elements inside the toast like <a /> or custom components by passing a function instead of a string. This work for both the title and description.

toast(
  () => (
    <>
      View{' '}
      <a href="https://google.com" target="_blank">
        Animation on the Web
      </a>
    </>
  ),
  {
    description: () => <button>This is a button element!</button>,
  },
);

Copy link

vercel bot commented Nov 2, 2024

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

Name Status Preview Comments Updated (UTC)
sonner ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 2, 2024 4:46pm

@emilkowalski emilkowalski merged commit 8789d52 into main Nov 2, 2024
3 checks passed
@emilkowalski emilkowalski deleted the allow-to-pass-custom-elements branch November 2, 2024 16:53
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.

1 participant