Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

619
Vistas
Nuxt 3 with Vuetify Icons

I am trying to get Vuetify 3 to work with Nuxt 3.

I have a plugin for Vuetify:

// plugins/vuetify.ts
import { defineNuxtPlugin } from '#app'
import { createVuetify } from 'vuetify'
import {
    VApp,
    VAppBar,
    VAppBarNavIcon,
    VAppBarTitle,
    VBtn,
    VIcon
} from 'vuetify/components'

// Import everything
// import * as components from 'vuetify/components'

export default defineNuxtPlugin((nuxtApp) => {
    const vuetify = createVuetify({
        components: {
            VApp,
            VAppBar,
            VAppBarNavIcon,
            VAppBarTitle,
            VBtn,
            VIcon
        },
        theme: {
            defaultTheme: 'myCustomTheme',
            themes: {
                myCustomTheme: {
                    dark: false,
                    variables: {}, // ✅ this property is required to avoid Vuetify crash

                    colors: {
                        // Workaround: Custom colors seem to erase default colors, so we need to include the default colors (of `light` or `dark` theme)
                        background: '#fff',
                        surface: '#fff',
                        primary: '#38b6ff',
                        'primary-darken-1': '#3700B3',
                        secondary: '#03DAC5',
                        'secondary-darken-1': '#03DAC5',
                        error: '#CF6679',
                        info: '#2196F3',
                        success: '#4CAF50',
                        warning: '#FB8C00',
                    },
                }
            }
        }
    })
    nuxtApp.vueApp.use(vuetify)
})

And my nuxt.config.ts looks like:

import { defineNuxtConfig } from 'nuxt3'

// https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
export default defineNuxtConfig({
    css: [
        'vuetify/lib/styles/main.sass',
        '@/assets/scss/main.scss',
    ],
    build: {
        transpile: ['vuetify']
    },
    vite: {
        define: {
            'process.env.DEBUG': 'false',
        }
    },
})

The css portion of the nuxt.config.ts imports the styles from vuetify, however icons are not working as expected. I have tried to use VIcon along with VAppBarNavIcon, both of which don't show the icon.

I have tried to manually download material-design-icons-iconfont from yarn and then add material-design-icons-iconfont/dist/material-design-icons.css to my css, but that did not work. Has anyone found a way to make this work? I want to use the regular mdi icons.

Thanks

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Install the Material Design icons

$ yarn add @mdi/js -D
// OR
$ npm install @mdi/js -D

Add this to your plugins/vuetify.ts:

import { createVuetify } from 'vuetify/lib'
import { aliases, mdi } from 'vuetify/lib/iconsets/mdi-svg'

export default createVuetify({
  icons: {
    defaultSet: 'mdi',
    aliases,
    sets: {
      mdi
    }
  }
})

And now since we only want to import the icons we are using use it like this:

<template>
  <v-icon :icon="mdiAccount" />
</template>

<script>
  import { mdiAccount } from '@mdi/js'

  export default {
    data: () => ({
      mdiAccount
    })
  }
</script>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda