Make it easier to work with Tailwind
See original GitHub issueI’m trying to customize my toasts with Tailwind, but I’m currently struggling with the default styles. I’m trying to override the styles with Tailwind but I can’t remove the default classes:
export const Toast: React.FunctionComponent<ToastProps> = ({
position = 'bottom-center',
toastOptions = {
className: 'text-xs font-semibold rounded-lg p-2',
success: {
icon: null,
className: 'text-xs font-semibold rounded-lg p-2 bg-green-300 text-green-900',
},
error: {
icon: null,
className: 'text-xs font-semibold rounded-lg p-2 bg-red-300 text-red-900',
},
},
...props
}: ToastProps) => {
return (
<Toaster position={position} toastOptions={toastOptions} {...props}>
{(t) => (
<ToastBar toast={t} position={position}>
{({ message }) => (
<>
{message}
</>
)}
</ToastBar>
)}
</Toaster>
);
};
But they are overrided with those styles https://github.com/timolins/react-hot-toast/blob/d1456c4e4fdc8210f24b08334a2a464efa815eb0/src/components/toast-bar.tsx#L21-L33 and I can’t even override those ones (remove margin) https://github.com/timolins/react-hot-toast/blob/d1456c4e4fdc8210f24b08334a2a464efa815eb0/src/components/toast-bar.tsx#L35-L41 Please think about removing those default styles so we can easily theme them by adding classes and styles or by adding an extra div.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How to Use Tailwind CSS to Rapidly Develop Snazzy Websites
Tailwind CSS is a powerful CSS framework that can cut down on your development time so you can focus on what's important.
Read more >10 Tailwind CSS tips to boost your productivity - LogRocket Blog
I like Tailwind for two reasons. First, it makes building responsive interfaces so much easier. When you master all the utility classes, ...
Read more >How Tailwind Can Help You Code Faster - DEV Community
Tailwind makes your life easier as a developer, whether you're a pro at CSS or not. Writing CSS more easily means less frustration...
Read more >How to use Tailwind CSS the clean way | by Lewin Probst
Why do you tend to write messy HTML code when using Tailwind CSS? ... As stated earlier, Tailwind is a utility-first framework that...
Read more >Tailwind CSS: What It Is, Why Use It & Examples - HubSpot Blog
Tailwind CSS is a utility-first CSS framework designed to enable users to create applications faster and easier. You can use utility classes ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@chrisrobbins Have a look at this example, which uses the Custom Renderer API, TailwindCSS & HeadlessUI for easy animations: https://codesandbox.io/s/react-hot-toast-tailwindcss-headless-ui-qvjri?file=/src/App.js
I made my own
<Toaster />
component so I could style anything the way I wanted