nuxt-mdi
Nuxt mdi
Add 7,000+ icons to your Nuxt project, from Material Design Icons.
Features
- Add 7,000+ icons, from Material Design Icons.
- TypeScript completion.
- Zero imports needed.
Getting Started
Installation
Install the nuxt-mdi
dependency to your project using your preferred package manager:
npx nuxi@latest module add nuxt-mdi
### Activation
Add `'nuxt-mdi'` to the `modules` section of your `nuxt.config.ts` file.
```ts
export default defineNuxtConfig({
modules: [
'nuxt-mdi'
]
})
That's it! You can now use nuxt-mdi in your Nuxt app ✨
Usage
The module will automatically make the MdiIcon
component available to your app. You can use it like this:
<MdiIcon icon="mdiAccount" />
Props:
icon
(string, required): The name of the icon to display.size
(boolean, default:'1em'
): Set the size of the icon. Defaults to1em
.flipX
(boolean, default:false
): Flip the icon on the X axis.flipY
(boolean, default:false
): Flip the icon on the Y axis.
Configuration
You can configure this module by adding an mdi
section to the nuxt.config.ts
file.
export default defineNuxtConfig({
// ...
mdi: {
componentName: 'MdiIcon',
defaultSize: '1em'
}
})
Component name: componentName
By default, the component name is MdiIcon
. You can change this by setting the componentName
option.
export default defineNuxtConfig({
// ...
mdi: {
componentName: 'MyIcon'
}
})
<MyIcon icon="mdiAccount" />
Default size: defaultSize
By default, the icons will be rendered at 1em
. You can change this by setting the defaultSize
option.
Icons
You can find available icons on the Material Design Icons website. IntelliSense will automatically display auto completion for the available icons.
If you are using VS Code, you can use the Vue Language Features (Volar) extension to get IntelliSense for Vue components.