ui icon indicating copy to clipboard operation
ui copied to clipboard

Support Tailwind Prefix

Open zSoulweaver opened this issue 9 months ago • 3 comments

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

zSoulweaver avatar Mar 18 '25 03:03 zSoulweaver

+1

We are migrating from bulma to tailwind and (eventually Nuxt UI) the prefix is kinda mandatory for this migration

yooouuri avatar Mar 19 '25 18:03 yooouuri

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

saschafuchs avatar Apr 10 '25 13:04 saschafuchs

Essential for me as well

franciscohermida avatar Apr 16 '25 04:04 franciscohermida

+1 Cannot use Nuxt UI without prefix support since we're wanting to migrate from Bootstrap

AverySJones avatar Apr 28 '25 21:04 AverySJones

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.

saschafuchs avatar Apr 29 '25 07:04 saschafuchs

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

  1. Using prefix as mentioned in this thread
  2. Using something like: postcss-prefix-selector
  3. Importing tailwind css in a namespace
  4. Add "important" to all styles in the namespace

Thx for any inspiration or help Christoph

cfroe avatar Oct 07 '25 13:10 cfroe

Hi @cfroe I solved by creating a custom element with shadow root

zAlweNy26 avatar Oct 07 '25 13:10 zAlweNy26

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.

  1. Do I need to change or add something in the the main.css?
@import "tailwindcss";
@import "@nuxt/ui";
:root {
  1. Set an id or whatever in the root HTML tag?
  2. Add something in nuxt.config,ts?
  3. Something else?

cfroe avatar Oct 07 '25 14:10 cfroe

@benjamincanac is it supposed to be released soon?

maxdzin avatar Nov 04 '25 13:11 maxdzin

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 avatar Nov 04 '25 13:11 maxdzin

@maxdzin This will be released in the next minor but I don't have an exact ETA, probably around two weeks!

benjamincanac avatar Nov 04 '25 14:11 benjamincanac