Support Tailwind Prefix
Description
There is a PR looking to solve for this #3009 however I figured I would still raise the issue.
Having Nuxt UI respect the tailwind prefix would be handy to have to not overlap styles if components are being utilised on pages that already have existing styles with the same name and are not using tailwind.
Additional context
No response
+1
We are migrating from bulma to tailwind and (eventually Nuxt UI) the prefix is kinda mandatory for this migration
This is super important, we need to use TW prefixes because the application we want to integrate our SPA into uses custom tailwind classes with !important. Without the prefixes the UI will not work
Essential for me as well
+1 Cannot use Nuxt UI without prefix support since we're wanting to migrate from Bootstrap
Somehow it is probably more important to overwrite a TW Color Token System instead of offering prefixes - which Tailwind has implemented for a reason. Not everyone needs this, but anyone who has to integrate their app into another application often experiences nasty surprises.
If nothing happens here, we will switch to Shadcn, which offers prefixing.
I am encountering the same problem right now, our application is embedded in another website. While searching around I found different approaches. Perhaps someone can help, what could be possible and how. In Nuxt UI I don't see the possibilty to use a tailwind.config
- Using prefix as mentioned in this thread
- Using something like: postcss-prefix-selector
- Importing tailwind css in a namespace
- Add "important" to all styles in the namespace
Thx for any inspiration or help Christoph
Hi @cfroe I solved by creating a custom element with shadow root
Hi @cfroe I solved by creating a custom element with shadow root
Thx for your fast response, could you explain more in detail, sorry I'm not so experienced with CSS.
- Do I need to change or add something in the the main.css?
@import "tailwindcss";
@import "@nuxt/ui";
:root {
- Set an id or whatever in the root HTML tag?
- Add something in nuxt.config,ts?
- Something else?
@benjamincanac is it supposed to be released soon?
Besides, thank you for implementing this long-awaited feature! It is a must-have for some complex projects, and I'm glad to try it soon.
@maxdzin This will be released in the next minor but I don't have an exact ETA, probably around two weeks!