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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3 #1289

Open
44 tasks done
benjamincanac opened this issue Jan 29, 2024 — with Volta.net · 326 comments
Open
44 tasks done

v3 #1289

benjamincanac opened this issue Jan 29, 2024 — with Volta.net · 326 comments
Assignees
Labels

Comments

Copy link
Member

benjamincanac commented Jan 29, 2024

The development is ongoing on the default branch of this repository: https://github.com/nuxt/ui.


A lot has changed since @nuxt/ui was made open-source (May 2023), so the plan here is to rewrite every component from scratch alongside their config.

I'll post regular updates on this issue and on https://twitter.com/benjamincanac.

Documentation

https://ui3.nuxt.dev

Roadmap (Nov 20, 2024)

Breaking Changes

The biggest change is the switch to tailwind-variants, this will cause lots of breaking changes if you've used the ui prop or app.config.ts to override the config. I apologize in advance for this but I strongly believe this will be beneficial and will bring consistency across all components.

At the beginning the config was split in many keys for the same div to give more flexibility, but since then we introduced tailwind-merge which now allows us to group those keys together, this is a good opportunity to clean the whole thing.

The config will now have a slots amongst other keys that will specifically target dom nodes. The ui prop will only allow you to target those slots.

These changes alongside the refactor of all components will also improve the types, the app.config.ts and ui props are now perfectly typed, as well as all components props, slots, emits and expose.

Feel free to comment on this if you have any ideas for the next major.

Components

Preview Give feedback
@benjamincanac benjamincanac added the v3 #1289 label Jan 29, 2024 — with Volta.net
@benjamincanac benjamincanac pinned this issue Jan 29, 2024
@benjamincanac benjamincanac added release and removed v3 #1289 labels Jan 29, 2024
@benjamincanac benjamincanac changed the title Major v3.0 release v3.0 release Jan 29, 2024
@benjamincanac benjamincanac changed the title v3.0 release Next v3.0 release Jan 29, 2024
@sandros94
Copy link
Member

I would like to help, if I'm able to. Is there going to be a dedicated branch or will it be done in the dev one?

Copy link
Member Author

Once we start this, there will be indeed a new branch with auto-release so we can try it out and especially keep working on the v2 as it might take some time. I'll create new issues once this gets started with the remaining things to do 😊

@jd-solanki
Copy link

Hi @benjamincanac

I have few design ideas if you are open to this I would like to share it for the future of Nuxt UI 3. Should we discuss this in this issue or it'll be better to discuss design ideas in seperate discussion thread?

Copy link
Member Author

@jd-solanki You can share them here!

@benjamincanac benjamincanac changed the title Next v3.0 release v3.0 Mar 4, 2024
@sawa-ko
Copy link

sawa-ko commented Mar 5, 2024

Since it is supposed to be a refactoring to all components, could we give the possibility of compatibility with unocss?

Copy link
Member Author

benjamincanac commented Mar 6, 2024

@sawa-ko It will be made with Tailwind v4. To what end would you make it compatible with Uno?

@benjamincanac benjamincanac self-assigned this Mar 6, 2024
Copy link
Member Author

benjamincanac commented Mar 6, 2024

I've started working on this in a private repository of mine, I'll open-source it once I'm satisfied with the base so you guys can check it out 😊.

A lot has changed since @nuxt/ui was made open-source (May 2023), so the plan here is to rewrite every component from scratch alongside their config. For example, at the beginning the config was split in many keys for the same div to give more flexibility, but since then we introduced tailwind-merge which now allows us to group those keys together.

I'll post regular updates on this issue.

@ghost
Copy link

ghost commented Mar 8, 2024

Please tell me how long it will take for this upgrade to be available.
Very much looking forward to this upgrade

Copy link
Member Author

I have no idea how long it will take and it's not entirely up to us, I hope to release it at the same time as the official release of Tailwind v4.

@robin-dongbin
Copy link

That's awesome. The new version of nuxt-ui uses exactly the tech stack I expected.

I tried to build my own UI library using radix-ui and tailwind-variants, but I immediately found that even with radix-ui, it is not easy to build a full UI library.

But I got an idea with an API that works with any design language. If you are interested, here is my demo repository:
https://github.com/vincajs/vinca-ui

Copy link
Member Author

@robin-dongbin It's already in the making. There are already 13 components done, 36 more to go 😅

@robin-dongbin
Copy link

Since the component library is based on radix-ui without styles, I thought it would be nice to provide an api that is abstracted from various design systems, so you can switch styles from one system to another at any time.

If people want to implement another design system, they can just customize it, share files, or even contribute to a repository.

Taking things a step further, it is possible to switch between different design systems at runtime.

Of course, I'm just offering an idea, and if you think it's too late, that's fine

Copy link
Member Author

This is actually already what we're doing with the App Config. You can customize the classes for every part of every component.

@aspitrine
Copy link

Thanks for the work!
i’m impatient to try this!

Just one question :

The biggest change is the switch to tailwind-variants, this will cause lots of breaking changes if you've used the ui prop or app.config.ts to override the config.

app.config.ts is deprecated and it will not port in v3? Or it’s something else?

Copy link
Member Author

No we keep the app.config.ts, what I meant is since we now use tailwind-variants the config itself changes.

For example the Kbd component, its config looked like this:

export default {
  base: 'inline-flex items-center justify-center text-gray-900 dark:text-white',
  padding: 'px-1',
  size: {
    xs: 'h-4 min-w-[16px] text-[10px]',
    sm: 'h-5 min-w-[20px] text-[11px]',
    md: 'h-6 min-w-[24px] text-[12px]'
  },
  rounded: 'rounded',
  font: 'font-medium font-sans',
  background: 'bg-gray-100 dark:bg-gray-800',
  ring: 'ring-1 ring-gray-300 dark:ring-gray-700 ring-inset',
  default: {
    size: 'sm'
  }
}

Here is the new version:

export default {
  base: 'inline-flex items-center justify-center text-gray-900 dark:text-white px-1 rounded font-medium font-sans bg-gray-50 dark:bg-gray-800 ring ring-gray-300 dark:ring-gray-700 ring-inset',
  variants: {
    size: {
      xs: 'h-4 min-w-[16px] text-[10px]',
      sm: 'h-5 min-w-[20px] text-[11px]',
      md: 'h-6 min-w-[24px] text-[12px]'
    }
  },
  defaultVariants: {
    size: 'sm'
  }
}

This is a breaking change if you've overridden its config in your app.config.ts or through the ui prop. I'm thinking of a CLI or something that would help people migrate from v2 to v3 without too much trouble but it might not be easy to achieve. Everything is fully typed so this will give some indications at least.

@aspitrine
Copy link

Ok !

Effectively, it's a breaking change but it seam ok for the future to have a better granularity with the variants.

Thanks for the explanation and the example 🙏🏻

@moshetanzer
Copy link
Contributor

Was UI 3 meant to look different. Really like the default font, text spacing and padding of UI 2 bit on all templates looks quite different?

@MickL
Copy link
Contributor

MickL commented Feb 27, 2025

Personally I was hoping for a visual improvement over v2. E.g. the examples in Reka UI look way better imo and I guess they delivered? I am super happy with the changes.

@benjamincanac
Copy link
Member Author

Hey guys, we're close to releasing an alpha.14 or a beta.1 (not sure yet) before releasing officially. If you have some urgent bugs that I missed, would you mind pinging me on the dedicated issues? Thanks!

@simonmaass
Copy link

@benjamincanac would you maybe mind releasing the alpha.14 today to fix the whole tailwindcss bugs and then a beta.1 with the missing bugs next week?

@MickL
Copy link
Contributor

MickL commented Feb 28, 2025

You can install latest commit as shown here:
https://ui3.nuxt.dev/getting-started/installation/nuxt#continuous-releases

@angelorc
Copy link

Hello, just tried to build with the beta.1 I'll get memory issues while prerender

ℹ Initializing prerenderer                                                                                                      nitro 17:51:19

<--- Last few GCs --->

[247498:0x36e05000]    68846 ms: Scavenge 3890.3 (3985.6) -> 3887.7 (3993.9) MB, pooled: 0 MB, 7.04 / 0.00 ms  (average mu = 0.317, current mu = 0.327) allocation failure; 
[247498:0x36e05000]    69561 ms: Mark-Compact (reduce) 3899.5 (4002.4) -> 3357.7 (3665.3) MB, pooled: 0 MB, 390.55 / 0.00 ms  (+ 308.4 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 715 ms) (average mu = 0.355, 

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

 1: 0xe36196 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [node]
 2: 0x123f4a0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 3: 0x123f777 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 4: 0x146d1a5  [node]
 5: 0x146d1d3  [node]
 6: 0x148628a  [node]
 7: 0x1489458  [node]
 8: 0x1cc6071  [node]

I also tried with NODE_OPTIONS='--max-old-space-size=4096' nuxt build

Copy link
Member Author

@angelorc
Copy link

@benjamincanac now works, build and dev works fine.

I just lost the style...

Before
Image

After
Image

Copy link
Member Author

benjamincanac commented Feb 28, 2025

Yes sorry I forgot to mention that in the release note, it's updated: https://github.com/nuxt/ui/releases/tag/v3.0.0-beta.1

You now have to do:

@import "tailwindcss" theme(static);

You can read more in #3374

@angelorc
Copy link

A bit better, but I loose my primary color. This is the main.css

@import "tailwindcss" theme(static);
@import "@nuxt/ui-pro";

@source "../../../content";

@theme {
  --font-sans: 'Public Sans', sans-serif;

  --color-radicalred-50: #ffeff2;
  --color-radicalred-100: #ffe0e7;
  --color-radicalred-200: #ffc6d6;
  --color-radicalred-300: #ff97b4;
  --color-radicalred-400: #ff005c;
  --color-radicalred-500: #ff005c;
  --color-radicalred-600: #ff005c;
  --color-radicalred-700: #d7004d;
  --color-radicalred-800: #b40049;
  --color-radicalred-900: #990245;
  --color-radicalred-950: #570020;

  --color-blackrussian-50: #9faffe;
  --color-blackrussian-100: #94a1fa;
  --color-blackrussian-200: #7b8ef9;
  --color-blackrussian-300: #5c70f5;
  --color-blackrussian-400: #3a43ee;
  --color-blackrussian-500: #1f1fe5;
  --color-blackrussian-600: #281ebe;
  --color-blackrussian-700: #2b258d;
  --color-blackrussian-800: #1e1c63;
  --color-blackrussian-900: #171844;
  --color-blackrussian-950: #14142e;
}

@layer base {
  :root, .light {
    --ui-bg: var(--color-neutral-50);
  }

  .dark {
    --ui-bg: #191919
  }
}

app.config

export default defineAppConfig({
  theme: {
    radius: 0.25
  },
  ui: {
    colors: {
      primary: 'radicalred',
      // gray: 'slate'
      neutral: 'zinc'
    }
  },
  uiPro: {
    pageHero: {
      slots: {
        description: 'font-light md:text-lg lg:text-xl text-[var(--ui-text-muted)]'
      }
    }
  }
})

Copy link
Member Author

Yes you also need @theme static { when overriding colors.

@angelorc
Copy link

awesome going to deploy :D

@alihardan
Copy link
Contributor

Hey guys, we're close to releasing an alpha.14 or a beta.1 (not sure yet) before releasing officially. If you have some urgent bugs that I missed, would you mind pinging me on the dedicated issues? Thanks!

We are already using it in production now, and everything seems to be working fine 🥳. The only thing is that you are not using @nuxtjs/tailwindcss anymore (they haven't released support for Tailwind 4 yet). If you plan to migrate to @nuxtjs/tailwindcss in the future, there will be breaking changes in the setup. I think there would be next major @nuxtjs/tailwindcss release because they have good reasons: nuxt-modules/tailwindcss#919 (comment)

@ineshbose
Copy link
Member

The only thing is that you are not using @nuxtjs/tailwindcss anymore (they haven't released support for Tailwind 4 yet). If you plan to migrate to @nuxtjs/tailwindcss in the future, there will be breaking changes in the setup. I think there would be next major @nuxtjs/tailwindcss release because they have good reasons: nuxt-modules/tailwindcss#919 (comment)

If I may speak here - I've discussed with Benjamin, and adding the next version of @nuxtjs/tailwindcss will likely not cause breaking changes, and would just shrink these lines:

ui/src/module.ts

Lines 77 to 82 in 9f241de

if (nuxt.options.builder === '@nuxt/vite-builder') {
const plugin = await import('@tailwindcss/vite').then(r => r.default)
addVitePlugin(plugin())
} else {
nuxt.options.postcss.plugins['@tailwindcss/postcss'] = {}
}

refer to implementation

There's more to it, like auto-adding CSS (i.e., @import "@nuxt/ui"), but that'll be opted out for this module. I'll try to have the next version before UI moves out of beta, but got a tight schedule atm!

@QuentinFarizon
Copy link

I have tried beta.2, but I still have the same issue of tailwind not applying at all 😅

I did add to main.css :

@import 'tailwindcss' theme(static);
@import '@nuxt/ui-pro';

Copy link
Member Author

@QuentinFarizon This should be fixed already, you have to make sure to have tailwindcss >= 4.0.8 in your lockfile, otherwise please open a new issue with a reproduction.

@QuentinFarizon
Copy link

I do have tailwindcss 4.0.9 🤔

@atinux atinux mentioned this issue Mar 4, 2025
1 task
@marckrenn
Copy link

@benjamincanac My Nuxt UI project suddenly stopped building overnight, failing with this log entry:

ERROR .nuxt/dist/server/server.mjs (20:18): "diff" is not exported by "node_modules/ohash/dist/index.mjs", imported by ".nuxt/dist/server/server.mjs".

Pinning ohash to 1.1.5 –as suggested in this comment– fixed it for me. According to @danielroe this is likely not a Nuxt, but rather a Nuxt UI issue so I thought I'd let you know 😃

Copy link
Member Author

benjamincanac commented Mar 4, 2025

@marckrenn It's always best to open a new issue for reporting bugs.. Yes we haven't updated ohash yet: #3362. Do you use it in your app?

@marckrenn
Copy link

@marckrenn It's always to open a new issue for reporting bugs.. Yes we haven't updated ohash yet: #3362.

I see, thanks for letting me know. I refrained to open a new issue as I couldn't yet verify if Nuxt UI truly is the culprit here. Just wanted to give you and others a heads up if they bump into the same problem.

Do you use it in your app?

Not proactively, only as dependencies of the following packages:

npm why ohash
[email protected] dev overridden
node_modules/ohash
  overridden ohash@"1.1.5" (was "^2.0.4") from [email protected]
  node_modules/c12
    overridden c12@"2.0.4" (was "2.0.1") from [email protected]
    node_modules/nitropack
      nitropack@"^2.10.4" from [email protected]
      node_modules/nuxt
        dev nuxt@"^3.15.4" from the root project
        peer nuxt@"^3.0.0" from @vueuse/[email protected]
        node_modules/@vueuse/nuxt
          dev @vueuse/nuxt@"12.7.0" from the root project
    overridden c12@"2.0.4" (was "^2.0.1") from [email protected]
    node_modules/nuxt
      dev nuxt@"^3.15.4" from the root project
      peer nuxt@"^3.0.0" from @vueuse/[email protected]
      node_modules/@vueuse/nuxt
        dev @vueuse/nuxt@"12.7.0" from the root project
    overridden c12@"2.0.4" (was "^3.0.2") from @nuxt/[email protected]
    node_modules/@nuxt/cli
      @nuxt/cli@"^3.21.1" from [email protected]
      node_modules/nuxt
        dev nuxt@"^3.15.4" from the root project
        peer nuxt@"^3.0.0" from @vueuse/[email protected]
        node_modules/@vueuse/nuxt
          dev @vueuse/nuxt@"12.7.0" from the root project
    overridden c12@"2.0.4" (was "^2.0.1") from @nuxt/[email protected]
    node_modules/@nuxt/kit
      @nuxt/kit@"3.15.4" from [email protected]
      node_modules/nuxt
        dev nuxt@"^3.15.4" from the root project
        peer nuxt@"^3.0.0" from @vueuse/[email protected]
        node_modules/@vueuse/nuxt
          dev @vueuse/nuxt@"12.7.0" from the root project
      @nuxt/kit@"^3.14.1592" from [email protected]
      node_modules/nuxt-gtag
        dev nuxt-gtag@"3.0.2" from the root project
      peerOptional @nuxt/kit@"^3.2.2" from [email protected]
      node_modules/unplugin-auto-import
        unplugin-auto-import@"^19.1.1" from @nuxt/[email protected]
        node_modules/@nuxt/ui
          dev @nuxt/ui@"^3.0.0-beta.2" from the root project
      peerOptional @nuxt/kit@"^3.2.2" from [email protected]
      node_modules/unplugin-vue-components
        unplugin-vue-components@"^28.4.1" from @nuxt/[email protected]
        node_modules/@nuxt/ui
          dev @nuxt/ui@"^3.0.0-beta.2" from the root project
      @nuxt/kit@"^3.15.4" from @nuxt/[email protected]
      node_modules/@nuxt/devtools
        dev @nuxt/devtools@"latest" from the root project
      @nuxt/kit@"^3.14.1592" from @nuxt/[email protected]
      node_modules/@nuxt/icon
        @nuxt/icon@"^1.10.3" from @nuxt/[email protected]
        node_modules/@nuxt/ui
          dev @nuxt/ui@"^3.0.0-beta.2" from the root project
      @nuxt/kit@"^3.15.4" from @nuxt/[email protected]
      node_modules/@nuxt/scripts
        dev @nuxt/scripts@"0.10.4" from the root project
      @nuxt/kit@"3.15.4" from @nuxt/[email protected]
      node_modules/@nuxt/vite-builder
        @nuxt/vite-builder@"3.15.4" from [email protected]
        node_modules/nuxt
          dev nuxt@"^3.15.4" from the root project
          peer nuxt@"^3.0.0" from @vueuse/[email protected]
          node_modules/@vueuse/nuxt
            dev @vueuse/nuxt@"12.7.0" from the root project
      @nuxt/kit@"^3.15.4" from @nuxt/[email protected]
      node_modules/@nuxt/telemetry
        @nuxt/telemetry@"^2.6.4" from [email protected]
        node_modules/nuxt
          dev nuxt@"^3.15.4" from the root project
          peer nuxt@"^3.0.0" from @vueuse/[email protected]
          node_modules/@vueuse/nuxt
            dev @vueuse/nuxt@"12.7.0" from the root project
      @nuxt/kit@"^3.15.4" from @nuxt/[email protected]
      node_modules/@nuxt/ui
        dev @nuxt/ui@"^3.0.0-beta.2" from the root project
      @nuxt/kit@"^3.13.2" from @nuxtjs/[email protected]
      node_modules/@nuxtjs/color-mode
        @nuxtjs/color-mode@"^3.5.2" from @nuxt/[email protected]
        node_modules/@nuxt/ui
          dev @nuxt/ui@"^3.0.0-beta.2" from the root project
      @nuxt/kit@"^3.15.4" from @nuxt/[email protected]
      node_modules/@nuxt/devtools-kit
        @nuxt/devtools-kit@"2.1.3" from @nuxt/[email protected]
        node_modules/@nuxt/devtools
          dev @nuxt/devtools@"latest" from the root project
      @nuxt/kit@"^3.14.1592" from @nuxt/[email protected]
      node_modules/@nuxt/fonts
        @nuxt/fonts@"^0.10.3" from @nuxt/[email protected]
        node_modules/@nuxt/ui
          dev @nuxt/ui@"^3.0.0-beta.2" from the root project
      @nuxt/kit@"^3.15.4" from @vueuse/[email protected]
      node_modules/@vueuse/nuxt
        dev @vueuse/nuxt@"12.7.0" from the root project
      @nuxt/kit@"^3.15.0" from @nuxt/[email protected]
      node_modules/nuxt/node_modules/@nuxt/devtools
        @nuxt/devtools@"^1.7.0" from [email protected]
        node_modules/nuxt
          dev nuxt@"^3.15.4" from the root project
          peer nuxt@"^3.0.0" from @vueuse/[email protected]
          node_modules/@vueuse/nuxt
            dev @vueuse/nuxt@"12.7.0" from the root project
      @nuxt/kit@"^3.15.0" from @nuxt/[email protected]
      node_modules/@nuxt/icon/node_modules/@nuxt/devtools-kit
        @nuxt/devtools-kit@"^1.6.4" from @nuxt/[email protected]
        node_modules/@nuxt/icon
          @nuxt/icon@"^1.10.3" from @nuxt/[email protected]
          node_modules/@nuxt/ui
            dev @nuxt/ui@"^3.0.0-beta.2" from the root project
      @nuxt/kit@"^3.15.0" from @nuxt/[email protected]
      node_modules/@nuxt/fonts/node_modules/@nuxt/devtools-kit
        @nuxt/devtools-kit@"^1.6.3" from @nuxt/[email protected]
        node_modules/@nuxt/fonts
          @nuxt/fonts@"^0.10.3" from @nuxt/[email protected]
          node_modules/@nuxt/ui
            dev @nuxt/ui@"^3.0.0-beta.2" from the root project
      @nuxt/kit@"^3.15.0" from @nuxt/[email protected]
      node_modules/nuxt/node_modules/@nuxt/devtools/node_modules/@nuxt/devtools-kit
        @nuxt/devtools-kit@"1.7.0" from @nuxt/[email protected]
        node_modules/nuxt/node_modules/@nuxt/devtools
          @nuxt/devtools@"^1.7.0" from [email protected]
          node_modules/nuxt
            dev nuxt@"^3.15.4" from the root project
            peer nuxt@"^3.0.0" from @vueuse/[email protected]
            node_modules/@vueuse/nuxt
              dev @vueuse/nuxt@"12.7.0" from the root project
  overridden ohash@"1.1.5" (was "^2.0.4") from [email protected]
  node_modules/vite-plugin-inspect
    vite-plugin-inspect@"^11.0.0" from @nuxt/[email protected]
    node_modules/@nuxt/devtools
      dev @nuxt/devtools@"latest" from the root project
  overridden ohash@"1.1.5" (was "^2.0.9") from @nuxt/[email protected]
  node_modules/@nuxt/cli
    @nuxt/cli@"^3.21.1" from [email protected]
    node_modules/nuxt
      dev nuxt@"^3.15.4" from the root project
      peer nuxt@"^3.0.0" from @vueuse/[email protected]
      node_modules/@vueuse/nuxt
        dev @vueuse/nuxt@"12.7.0" from the root project
  overridden ohash@"1.1.5" (was "^2.0.9") from @nuxt/[email protected]
  node_modules/@nuxt/devtools
    dev @nuxt/devtools@"latest" from the root project

[email protected] dev overridden
node_modules/nitropack/node_modules/ohash
  overridden ohash@"1.1.5" (was "^1.1.4") from [email protected]
  node_modules/nitropack
    nitropack@"^2.10.4" from [email protected]
    node_modules/nuxt
      dev nuxt@"^3.15.4" from the root project
      peer nuxt@"^3.0.0" from @vueuse/[email protected]
      node_modules/@vueuse/nuxt
        dev @vueuse/nuxt@"12.7.0" from the root project

[email protected] dev overridden
node_modules/reka-ui/node_modules/ohash
  overridden ohash@"1.1.5" (was "^1.1.4") from [email protected]
  node_modules/reka-ui
    reka-ui@"^2.0.0" from [email protected]
    node_modules/vaul-vue
      vaul-vue@"^0.3.0" from @nuxt/[email protected]
      node_modules/@nuxt/ui
        dev @nuxt/ui@"^3.0.0-beta.2" from the root project
    reka-ui@"^2.0.2" from @nuxt/[email protected]
    node_modules/@nuxt/ui
      dev @nuxt/ui@"^3.0.0-beta.2" from the root project

[email protected] dev overridden
node_modules/unifont/node_modules/ohash
  overridden ohash@"1.1.5" (was "^1.1.4") from [email protected]
  node_modules/unifont
    unifont@"^0.1.6" from @nuxt/[email protected]
    node_modules/@nuxt/fonts
      @nuxt/fonts@"^0.10.3" from @nuxt/[email protected]
      node_modules/@nuxt/ui
        dev @nuxt/ui@"^3.0.0-beta.2" from the root project

[email protected] dev overridden
node_modules/@nuxt/kit/node_modules/ohash
  overridden ohash@"1.1.5" (was "^1.1.4") from @nuxt/[email protected]
  node_modules/@nuxt/kit
    @nuxt/kit@"3.15.4" from [email protected]
    node_modules/nuxt
      dev nuxt@"^3.15.4" from the root project
      peer nuxt@"^3.0.0" from @vueuse/[email protected]
      node_modules/@vueuse/nuxt
        dev @vueuse/nuxt@"12.7.0" from the root project
    @nuxt/kit@"^3.14.1592" from [email protected]
    node_modules/nuxt-gtag
      dev nuxt-gtag@"3.0.2" from the root project
    peerOptional @nuxt/kit@"^3.2.2" from [email protected]
    node_modules/unplugin-auto-import
      unplugin-auto-import@"^19.1.1" from @nuxt/[email protected]
      node_modules/@nuxt/ui
        dev @nuxt/ui@"^3.0.0-beta.2" from the root project
    peerOptional @nuxt/kit@"^3.2.2" from [email protected]
    node_modules/unplugin-vue-components
      unplugin-vue-components@"^28.4.1" from @nuxt/[email protected]
      node_modules/@nuxt/ui
        dev @nuxt/ui@"^3.0.0-beta.2" from the root project
    @nuxt/kit@"^3.15.4" from @nuxt/[email protected]
    node_modules/@nuxt/devtools
      dev @nuxt/devtools@"latest" from the root project
    @nuxt/kit@"^3.14.1592" from @nuxt/[email protected]
    node_modules/@nuxt/icon
      @nuxt/icon@"^1.10.3" from @nuxt/[email protected]
      node_modules/@nuxt/ui
        dev @nuxt/ui@"^3.0.0-beta.2" from the root project
    @nuxt/kit@"^3.15.4" from @nuxt/[email protected]
    node_modules/@nuxt/scripts
      dev @nuxt/scripts@"0.10.4" from the root project
    @nuxt/kit@"3.15.4" from @nuxt/[email protected]
    node_modules/@nuxt/vite-builder
      @nuxt/vite-builder@"3.15.4" from [email protected]
      node_modules/nuxt
        dev nuxt@"^3.15.4" from the root project
        peer nuxt@"^3.0.0" from @vueuse/[email protected]
        node_modules/@vueuse/nuxt
          dev @vueuse/nuxt@"12.7.0" from the root project
    @nuxt/kit@"^3.15.4" from @nuxt/[email protected]
    node_modules/@nuxt/telemetry
      @nuxt/telemetry@"^2.6.4" from [email protected]
      node_modules/nuxt
        dev nuxt@"^3.15.4" from the root project
        peer nuxt@"^3.0.0" from @vueuse/[email protected]
        node_modules/@vueuse/nuxt
          dev @vueuse/nuxt@"12.7.0" from the root project
    @nuxt/kit@"^3.15.4" from @nuxt/[email protected]
    node_modules/@nuxt/ui
      dev @nuxt/ui@"^3.0.0-beta.2" from the root project
    @nuxt/kit@"^3.13.2" from @nuxtjs/[email protected]
    node_modules/@nuxtjs/color-mode
      @nuxtjs/color-mode@"^3.5.2" from @nuxt/[email protected]
      node_modules/@nuxt/ui
        dev @nuxt/ui@"^3.0.0-beta.2" from the root project
    @nuxt/kit@"^3.15.4" from @nuxt/[email protected]
    node_modules/@nuxt/devtools-kit
      @nuxt/devtools-kit@"2.1.3" from @nuxt/[email protected]
      node_modules/@nuxt/devtools
        dev @nuxt/devtools@"latest" from the root project
    @nuxt/kit@"^3.14.1592" from @nuxt/[email protected]
    node_modules/@nuxt/fonts
      @nuxt/fonts@"^0.10.3" from @nuxt/[email protected]
      node_modules/@nuxt/ui
        dev @nuxt/ui@"^3.0.0-beta.2" from the root project
    @nuxt/kit@"^3.15.4" from @vueuse/[email protected]
    node_modules/@vueuse/nuxt
      dev @vueuse/nuxt@"12.7.0" from the root project
    @nuxt/kit@"^3.15.0" from @nuxt/[email protected]
    node_modules/nuxt/node_modules/@nuxt/devtools
      @nuxt/devtools@"^1.7.0" from [email protected]
      node_modules/nuxt
        dev nuxt@"^3.15.4" from the root project
        peer nuxt@"^3.0.0" from @vueuse/[email protected]
        node_modules/@vueuse/nuxt
          dev @vueuse/nuxt@"12.7.0" from the root project
    @nuxt/kit@"^3.15.0" from @nuxt/[email protected]
    node_modules/@nuxt/icon/node_modules/@nuxt/devtools-kit
      @nuxt/devtools-kit@"^1.6.4" from @nuxt/[email protected]
      node_modules/@nuxt/icon
        @nuxt/icon@"^1.10.3" from @nuxt/[email protected]
        node_modules/@nuxt/ui
          dev @nuxt/ui@"^3.0.0-beta.2" from the root project
    @nuxt/kit@"^3.15.0" from @nuxt/[email protected]
    node_modules/@nuxt/fonts/node_modules/@nuxt/devtools-kit
      @nuxt/devtools-kit@"^1.6.3" from @nuxt/[email protected]
      node_modules/@nuxt/fonts
        @nuxt/fonts@"^0.10.3" from @nuxt/[email protected]
        node_modules/@nuxt/ui
          dev @nuxt/ui@"^3.0.0-beta.2" from the root project
    @nuxt/kit@"^3.15.0" from @nuxt/[email protected]
    node_modules/nuxt/node_modules/@nuxt/devtools/node_modules/@nuxt/devtools-kit
      @nuxt/devtools-kit@"1.7.0" from @nuxt/[email protected]
      node_modules/nuxt/node_modules/@nuxt/devtools
        @nuxt/devtools@"^1.7.0" from [email protected]
        node_modules/nuxt
          dev nuxt@"^3.15.4" from the root project
          peer nuxt@"^3.0.0" from @vueuse/[email protected]
          node_modules/@vueuse/nuxt
            dev @vueuse/nuxt@"12.7.0" from the root project

[email protected] dev overridden
node_modules/@nuxt/vite-builder/node_modules/ohash
  overridden ohash@"1.1.5" (was "^1.1.4") from @nuxt/[email protected]
  node_modules/@nuxt/vite-builder
    @nuxt/vite-builder@"3.15.4" from [email protected]
    node_modules/nuxt
      dev nuxt@"^3.15.4" from the root project
      peer nuxt@"^3.0.0" from @vueuse/[email protected]
      node_modules/@vueuse/nuxt
        dev @vueuse/nuxt@"12.7.0" from the root project

[email protected] dev overridden
node_modules/@nuxt/scripts/node_modules/ohash
  overridden ohash@"1.1.5" (was "^1.1.4") from @nuxt/[email protected]
  node_modules/@nuxt/scripts
    dev @nuxt/scripts@"0.10.4" from the root project

[email protected] dev overridden
node_modules/@nuxt/ui/node_modules/ohash
  overridden ohash@"1.1.5" (was "^1.1.4") from @nuxt/[email protected]
  node_modules/@nuxt/ui
    dev @nuxt/ui@"^3.0.0-beta.2" from the root project

[email protected] dev overridden
node_modules/nuxt/node_modules/ohash
  overridden ohash@"1.1.5" (was "^1.1.4") from [email protected]
  node_modules/nuxt
    dev nuxt@"^3.15.4" from the root project
    peer nuxt@"^3.0.0" from @vueuse/[email protected]
    node_modules/@vueuse/nuxt
      dev @vueuse/nuxt@"12.7.0" from the root project
  overridden ohash@"1.1.5" (was "^1.1.4") from @nuxt/[email protected]
  node_modules/nuxt/node_modules/@nuxt/devtools
    @nuxt/devtools@"^1.7.0" from [email protected]
    node_modules/nuxt
      dev nuxt@"^3.15.4" from the root project
      peer nuxt@"^3.0.0" from @vueuse/[email protected]
      node_modules/@vueuse/nuxt
        dev @vueuse/nuxt@"12.7.0" from the root project

[email protected] dev overridden
node_modules/@nuxt/icon/node_modules/ohash
  overridden ohash@"1.1.5" (was "^1.1.4") from @nuxt/[email protected]
  node_modules/@nuxt/icon
    @nuxt/icon@"^1.10.3" from @nuxt/[email protected]
    node_modules/@nuxt/ui
      dev @nuxt/ui@"^3.0.0-beta.2" from the root project

[email protected] dev overridden
node_modules/@nuxt/fonts/node_modules/ohash
  overridden ohash@"1.1.5" (was "^1.1.4") from @nuxt/[email protected]
  node_modules/@nuxt/fonts
    @nuxt/fonts@"^0.10.3" from @nuxt/[email protected]
    node_modules/@nuxt/ui
      dev @nuxt/ui@"^3.0.0-beta.2" from the root project

@benjamincanac
Copy link
Member Author

You can keep the resolution I guess until the next release, just merged the PR to update ohash.

@FADL285
Copy link
Contributor

FADL285 commented Mar 10, 2025

@benjamincanac
I have @nuxt/ui: "^3.0.0-beta.3", in Nuxt 4 App and the Tailwind CSS utility classes are not working in the component style block.

For example, in AppNavbar.vue:

<script lang="ts" setup></script>

<template>
  <nav class="py-12">
    <UContainer>
      <div class="flex justify-between items-center">
        <!-- LOGO  -->
        <h1>LOGO</h1>

        <!-- NAV -->
        <ul class="flex gap-4">
          <li>
            <a href="#">Home</a>
          </li>
          <li>
            <a href="#">About</a>
          </li>
        </ul>
      </div>
    </UContainer>
  </nav>
</template>

<style scoped>
ul {
  @apply bg-amber-400;
}
</style>

I receive the following error: [plugin:@tailwindcss/vite:generate:serve] Cannot apply unknown utility class: bg-amber-400 in app/components/AppNavbar.vue.

and the css file:

@import "tailwindcss" theme(static);
@import "@nuxt/ui";

@theme static {
  --color-primary: #15405A;
  --color-secondary: #55BFCF;
}

:root {
  --ui-primary: var(--color-primary);
  --ui-secondary: var(--color-secondary);
}

@clopezpro
Copy link
Contributor

@benjamincanac Tengo @nuxt/ui: "^3.0.0-beta.3", en la aplicación Nuxt 4 y las clases de utilidad CSS Tailwind no funcionan en el bloque de estilo del componente.

Por ejemplo, en AppNavbar.vue:

<script lang="ts" setup></script>

LOGO

    <!-- NAV -->
    <ul class="flex gap-4">
      <li>
        <a href="#">Home</a>
      </li>
      <li>
        <a href="#">About</a>
      </li>
    </ul>
  </div>
</UContainer>
<style scoped> ul { @apply bg-amber-400; } </style>

Recibo el siguiente error: [plugin:@tailwindcss/vite:generate:serve] Cannot apply unknown utility class: bg-amber-400en app/components/AppNavbar.vue.

y el archivo css:

@import "tailwindcss" theme(static);
@import "@nuxt/ui";

@theme static {
--color-primary: #15405A;
--color-secondary: #55BFCF;
}

:root {
--ui-primary: var(--color-primary);
--ui-secondary: var(--color-secondary);
}

Try to use @reference "../../assets/css/main.css";

Reference to your Main CSS file where your songs and tailwincss import

@simonmaass
Copy link

simonmaass commented Mar 10, 2025

@FADL285 @apply is not working anymore in component style tag in tailwindcss v4
tailwindlabs/tailwindcss#16429

@FADL285
Copy link
Contributor

FADL285 commented Mar 10, 2025

@benjamincanac Tengo @nuxt/ui: "^3.0.0-beta.3", en la aplicación Nuxt 4 y las clases de utilidad CSS Tailwind no funcionan en el bloque de estilo del componente.
Por ejemplo, en AppNavbar.vue:

<script lang="ts" setup></script>
    # LOGO
    <!-- NAV -->
    <ul class="flex gap-4">
      <li>
        <a href="#">Home</a>
      </li>
      <li>
        <a href="#">About</a>
      </li>
    </ul>
  </div>
</UContainer>
<style scoped> ul { [@apply](https://github.com/apply) bg-amber-400; } </style>

Recibo el siguiente error: [plugin:@tailwindcss/vite:generate:serve] Cannot apply unknown utility class: bg-amber-400en app/components/AppNavbar.vue.
y el archivo css:
@import "tailwindcss" theme(static);
@import "@nuxt/ui";
@theme static {
--color-primary: #15405A;
--color-secondary: #55BFCF;
}
:root {
--ui-primary: var(--color-primary);
--ui-secondary: var(--color-secondary);
}

Try to use @reference "../../assets/css/main.css";

Reference to your Main CSS file where your songs and tailwincss import

@clopezpro It works, but why is this needed?!

Why doesn't it work directly like v2?

@clopezpro
Copy link
Contributor

@benjamincanac Tengo @nuxt/ui: "^3.0.0-beta.3", en la aplicación Nuxt 4 y las clases de utilidad CSS Tailwind no funcionan en el bloque de estilo del componente.
Por ejemplo, en AppNavbar.vue:

<script lang="ts" setup></script>
    # LOGO
    <!-- NAV -->
    <ul class="flex gap-4">
      <li>
        <a href="#">Home</a>
      </li>
      <li>
        <a href="#">About</a>
      </li>
    </ul>
  </div>
</UContainer>
<style scoped> ul { [[@apply](https://github.com/apply)](https://github.com/apply) bg-amber-400; } </style>

Recibo el siguiente error: [plugin:@tailwindcss/vite:generate:serve] Cannot apply unknown utility class: bg-amber-400en app/components/AppNavbar.vue.
y el archivo css:
@import "tailwindcss" theme(static);
@import "@nuxt/ui";
@theme static {
--color-primary: #15405A;
--color-secondary: #55BFCF;
}
:root {
--ui-primary: var(--color-primary);
--ui-secondary: var(--color-secondary);
}

Try to use @reference "../../assets/css/main.css";
Reference to your Main CSS file where your songs and tailwincss import

@clopezpro It works, but why is this needed?!

Why doesn't it work directly like v2?
It is because V3 uses Tailwindcs V4
#2772
https://tailwindcss.com/docs/upgrade-guide#using-apply-with-vue-svelte-or-css-modules

@omar-momen
Copy link

CSS Layer Prioritization Issue in Nuxt UI v3(beta) with Tailwind CSS v4

Describe the Bug

In Nuxt UI v3 (beta) with Tailwind CSS v4, the CSS layer prioritization is incorrect. Specifically, the utilities inside the components layer are not being applied correctly due to improper layer ordering.

Expected Behavior

The correct layer order should be:

  1. base
  2. theme
  3. components
  4. utilities

However, the current order sometimes places theme or components before base, causing styling conflicts and preventing utility classes from functioning properly inside components.

Screenshots

Correct Order (Tailwind 4 - Expected Behavior)
Corrected Order

Incorrect Order (Current Behavior in Nuxt UI v3 + Tailwind 4)
Incorrect Order

Reproduction Steps

  1. Use Nuxt UI v3 (beta) with Tailwind CSS v4.
  2. Define CSS layers in Tailwind.
  3. Open DevTools and inspect the CSS layers order.
  4. Notice that theme or components is incorrectly placed before base, affecting utility application.

Environment

  • Nuxt UI: v3 (beta)
  • Tailwind CSS: v4

Additional Context

This issue significantly affects component styling, as utility classes within components may be overridden or not applied correctly.

@MickL
Copy link
Contributor

MickL commented Mar 11, 2025

I think you should open a dedicated issue for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests