How can i use tailwind css and mantine together ?? #1672
-
Hello Team 👋 !! while working on big project . I'm facing big trouble for every single thing such as notification , modal etc . For All those stuff i have to write it from scratch which is very painful for developer who is handling frontend and backend both . Then i found fireship video on Mantine (he brief described about mantine) .
|
Beta Was this translation helpful? Give feedback.
Replies: 15 comments 72 replies
-
You can use mantine with tw without any additional setup, just install both libraries. Make sure not to include tw base styles as they will mess up with some components. |
Beta Was this translation helpful? Give feedback.
-
Here's the screenshot of my react project ( just testing )
Mantine is working but tailwind isn't 😞 . |
Beta Was this translation helpful? Give feedback.
-
Here's example by @kwiat1990
|
Beta Was this translation helpful? Give feedback.
-
None of the above solutions worked for us. We had to use a custom Emotion cache with This works but causes a flash of css on production. For this you need to make sure you are rendering that same emotion Cache during SSR build. |
Beta Was this translation helpful? Give feedback.
-
I am using Mantine with Tailwind and had no issues until today. I was working on a functionality to scale an image on hover and since using Next Image I used tailwind to configure the hover behaviour via className. The issue I encountered is the scale functionality (transform function to be more specific) didn't work. After a bit of research I found out that '@tailwind base' should be imported in global styles to make it work. The problem is base styles of tailwind overrides/clashes with the Mantine's so I couldn't find a proper solution to use tailwind fully with Mantine given this constraint. |
Beta Was this translation helpful? Give feedback.
-
@rtivital @AliDayi97 I've found, after long hours of trying, maybe even days, that https://mantine.dev/theming/emotion-cache/#server-side-rendering-with-custom-cache doesn't work for me (and possibly others like AliDayi97).
use:
|
Beta Was this translation helpful? Give feedback.
-
Sorry to bump this but you probably don't need to remove @base but just set preflight to false in the tailwind config like so:
|
Beta Was this translation helpful? Give feedback.
-
I spent the time last night to make a repro with the latest version of Mantine and Tailwind together. There is a button and slider example in there. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Thanks, that helped me too! |
Beta Was this translation helpful? Give feedback.
-
Hi, i would like to style with tailwind for non-mantine components, is there a way for us to sync the variables used in mantine (eg: spacing size, colors, etc) to tailwind so both have consistent style? |
Beta Was this translation helpful? Give feedback.
-
Sorry I couldn't say as I'm no longer using this in my projects, maybe
someone else can help with this?
…On Mon, 16 Sept 2024, 12:45 Jeroen, ***@***.***> wrote:
@TheKnightCoder <https://github.com/TheKnightCoder> in my case, ring
classes are now broken, are they still working for you? Even if I remove
Mantine it's still an issue.
—
Reply to this email directly, view it on GitHub
<#1672 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFZLCCGZDZRHOAOQAWVIELLZW3AG7AVCNFSM5ZWKS5YKU5DIOJSWCZC7NNSXTOSENFZWG5LTONUW63SDN5WW2ZLOOQ5TCMBWGU4DMMRX>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I've created a package // `bg-red-500` will be `background-color: var(--mantine-color-red-5)`
// `text-white` will be `color: var(--mantine-color-white)`
<Button className="bg-red-500 text-white">Hello</Button> Additionally, I've put together a guide on how to use @layer tw_base, mantine, tw_components, tw_utilities;
/* import tailwind */
@import "tailwindcss/base" layer(tw_base);
@import "tailwindcss/components" layer(tw_components);
@import "tailwindcss/utilities" layer(tw_utilities);
/* import mantine */
@import "@mantine/core/styles.layer.css"; For more details, check out https://github.com/Songkeys/tailwind-preset-mantine#prevent-style-conflicts. I've been using this layering method in many of my projects for months, and it works wonderfully! A minimal template: https://github.com/songkeys/next-app-mantine-tailwind-template |
Beta Was this translation helpful? Give feedback.
-
I'm using Mantine 7.13.4, tailwind ^3.4.14 and next js 14.2.11. I am facing a problem that the Slider component on Safari is running very slow in both dev and prod. But works good on Chrome. Has anyone encountered this issue? global.css
tailwind.config.js
postcss.config.js
|
Beta Was this translation helpful? Give feedback.
-
TailwindCSS V4 + Mantine V7 Example: app.css @layer theme, base, mantine, components, utilities;
@import 'tailwindcss';
@import '@mantine/core/styles.layer.css'; |
Beta Was this translation helpful? Give feedback.
You can use mantine with tw without any additional setup, just install both libraries. Make sure not to include tw base styles as they will mess up with some components.