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

richColors does not style action button and other styling methods do not work #475

Open
williamlmao opened this issue Aug 1, 2024 · 2 comments

Comments

@williamlmao
Copy link

 <Toaster
          position="top-right"
          theme="dark"
          richColors
        />

Results in the following toast:
image

When I try to style it in the following ways, nothing works:

 <Toaster
          position="top-right"
          theme="dark"
          richColors
          toastOptions={{
            classNames: {
              actionButton: 'bg-green-900 text-white',
            },
          }}
        />
     ```   
        This api also seems bad because you can't specify specific styles for each variant. 
        
       Which led me to try styling like this: 
       
           toast.success(title, {
      description: message,
      duration,
      action,
      classNames: {
        actionButton: 'group-[.toast]:bg-green-300 group-[.toast]:text-green-900',
      },
    });
    
        toast.success(title, {
      description: message,
      duration,
      action,
      classNames: {
        actionButton: 'bg-green-300 text-green-900',
      },
    });
    
But in the end the toast still had a white button. Has anyone else encountered this?
<img width="449" alt="image" src="https://github.com/user-attachments/assets/666006c2-245c-4a34-8f40-02259997e89b">

@williamlmao williamlmao changed the title richColors does not style action button richColors does not style action button and other styling methods do not work Aug 1, 2024
@jkinley
Copy link

jkinley commented Aug 27, 2024

I agree it does seem really difficult to theme these with different variants. Other than that its a siick lib.

@neokyox
Copy link

neokyox commented Sep 3, 2024

@williamlmao the only way I've found to style the buttons was using arbitrary variants plus important modifier, like so:

<Sonner
  theme='light'
  richColors
  toastOptions={{
    classNames: {
      toast: 'shadow-lg rounded-lg flex items-center p-4 text-xs gap-1.5',
      error: '[&>button]:!bg-red-600',
      info: '[&>button]:!bg-blue-600',
      success: '[&>button]:!bg-green-600',
      warning: '[&>button]:!bg-yellow-600',
    },
  }}
/>

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

No branches or pull requests

3 participants