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

How to override components style globally when using within another Nuxt Module? #3679

Open
LWojtek opened this issue Mar 25, 2025 · 1 comment
Labels
question Further information is requested v3 #1289

Comments

@LWojtek
Copy link

LWojtek commented Mar 25, 2025

Description

Hi,
I'm struggling to customize my components when using Nuxt UI within another Nuxt Module, I've search but cannot get it to work, tried with using app.config.ts like below and also within module.ts but no joy, would appreciate if someone could help out.

export default defineAppConfig({
  ui: {
    button: {
      slots: {
        base: 'rounded-full font-semibold cursor-pointer'
      },
    },
  }
})

My module.ts file:

import { defineNuxtModule, installModule, createResolver } from '@nuxt/kit'

export default defineNuxtModule<ModuleOptions>({
  meta: {
    name: 'my-module',
    configKey: 'myModule',
  },
  hooks: {
    'nitro:config': (nitroConfig) => {
      const { resolve } = createResolver(import.meta.url)

      nitroConfig.publicAssets ||= []
      nitroConfig.publicAssets.push({
        dir: resolve('./runtime/images/'),
        maxAge: 60 * 60 * 24 * 365,
      })
    },
  },
  defaults: {},
  async setup(_options, _nuxt) {
    const { resolve } = createResolver(import.meta.url)


    await installModule('@nuxt/ui')
    await installModule('nuxt-svgo', {
      autoImportPath: resolve('./runtime/icons'),
      defaultImport: 'component',
      componentPrefix: 'i',
    })

    _nuxt.options.css.push(resolve('./runtime/style.css'))
  },
})

@LWojtek LWojtek added question Further information is requested v3 #1289 labels Mar 25, 2025
@LWojtek LWojtek changed the title Customize components when using within Nuxt Module Override component style when using within Nuxt Module Mar 25, 2025
@LWojtek LWojtek changed the title Override component style when using within Nuxt Module Override component style when using within another Nuxt Module Mar 25, 2025
@LWojtek LWojtek changed the title Override component style when using within another Nuxt Module How to override component style when using within another Nuxt Module? Mar 25, 2025
@LWojtek LWojtek changed the title How to override component style when using within another Nuxt Module? How to override components style globally when using within another Nuxt Module? Mar 26, 2025
@LWojtek
Copy link
Author

LWojtek commented Mar 27, 2025

Is it even possible to theme Nuxt UI components within another module?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested v3 #1289
Projects
None yet
Development

No branches or pull requests

1 participant