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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to remove inherent padding? #333

Open
salieflewis opened this issue Feb 11, 2024 · 3 comments
Open

How to remove inherent padding? #333

salieflewis opened this issue Feb 11, 2024 · 3 comments

Comments

@salieflewis
Copy link
Contributor

Describe the feature / bug 馃摑:

I'm styling my Sonner component via classnames, and they don't take up the same amount of width as the default styles. Essentially the default styles have too much horizontal padding. If I remove the default padding by adding a class such as w-fit the toasts that fire don't appear centered anymore.

For further context, the toasts are configured in my root layout to be bottom-center.

@NaveenkumarMD
Copy link

There is a way to render your custom components . Customize this in your own way

toast.message(<MyComponent/>)

@salieflewis
Copy link
Contributor Author

There is a way to render your custom components . Customize this in your own way

toast.message(<MyComponent/>)

In my experience, doing this causes the positioning classes to work inaccurately.

@atsixian
Copy link
Contributor

atsixian commented Mar 9, 2024

You can use className prop on Toaster which adds styles to the outermost ol tag, instead of toastOptions.classNames. What I did was adding w-full and flex to center the inner toasts.

See live demo.

toast(<CustomToast />)

<Toaster
  position="bottom-center"
  className="w-full flex items-center justify-center"
  toastOptions={{
    unstyled: true,
  }}
/>

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