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

Add classNames.icon option #351

Closed
wants to merge 1 commit into from

Conversation

trevorblades
Copy link

What has been done ✅:

I added an icon property to the classNames toast option. This allows users to style the <div data-icon=""> element using tailwind. This would be very useful to give the icon common styles like width/height:

<Toaster
  toastOptions={{
    unstyled: true,
    classNames: {
      icon: "size-6"
    },
  }}
/>

Currently, I have to add the size-6 classname to each icon in my icons override:

<Toaster
  icons={{
    error: <ExclamationCircleIcon className="size-6" />,
    warning: <ExclamationTriangleIcon className="size-6" />,
    info: <InformationCircleIcon className="size-6" />,
    success: <CheckCircleIcon className="size-6" />,
  }}
/>

Copy link

vercel bot commented Feb 24, 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 Feb 24, 2024 2:17am

@landg16
Copy link

landg16 commented Mar 5, 2024

@emilkowalski please merge this, can't change icon sizes and style :(

@trevorblades
Copy link
Author

It looks like this is a duplicate of #372. I think this one can be closed since that one has already been merged.

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.

3 participants