vuetify-nuxt-module icon indicating copy to clipboard operation
vuetify-nuxt-module copied to clipboard

How to use mdi-svg

Open BobTheShoplifter opened this issue 1 year ago • 7 comments

In vue 2 the trick was:

import { mdiArrowDownRight, mdiFormatQuoteOpen, mdiArrowRight } from '@mdi/js'

then

<v-icon size="19" :icon="mdiArrowRight"></v-icon></v-avatar>

But does it auto import the icons when setting

defaultSet: 'mdi-svg',

How can i for example use mdiArrowRight in my page?

BobTheShoplifter avatar May 04 '24 19:05 BobTheShoplifter

Check https://vuetify-nuxt-module.netlify.app/guide/icons/svg-icons.html and https://vuetify-nuxt-module.netlify.app/guide/icons/integrations.html

userquin avatar May 04 '24 19:05 userquin

If the question is about using it with v-icon you should ask in vuetify repo.

userquin avatar May 04 '24 19:05 userquin

Importing works but i was wondering how the mdi-svg worked

BobTheShoplifter avatar May 04 '24 19:05 BobTheShoplifter

Check any repo here: https://vuetify-nuxt-module.netlify.app/guide/icons/integrations.html

Basically v-icon accepts an string or a component, it just renders it: @mdi/js just exports the svg icons as js objects, then v-icon just renders the corresponding icon.

userquin avatar May 04 '24 19:05 userquin

Yeah, i am wondering how do i access the js object that @mdi/js exports?

BobTheShoplifter avatar May 04 '24 19:05 BobTheShoplifter

just import the icon you want: import { mdiArrowDownRight, mdiFormatQuoteOpen, mdiArrowRight } from '@mdi/js'

userquin avatar May 04 '24 19:05 userquin

Aha! Yes this is what i am doing right now. I just tought the imports was automatic in all components and pages

BobTheShoplifter avatar May 04 '24 20:05 BobTheShoplifter