Use Font Awesome icons with the @nuxtjs/fontawesome module (Uses vue-fontawesome under the hood).
Example:
<font-awesome-icon :icon="['fas', 'wifi']" />
Don't forget to add the new icon to nuxt.config.js
:
fontawesome: {
icons: {
solid: [
+ 'faWifi'
],
}
}
See Font Awesome Docs.
Note: You may need to restart Nuxt to see new icons.
Warning: Use only free icons.
Create a component for your SVG icon in ~/components/icons
. Use .svg-icon-inline
class.
~/components/icons/IconMylogo.vue
:
<template>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
stroke="currentColor"
class="svg-icon-inline"
>
<path d="M..." />
</svg>
</template>
Use it:
<IconMylogo />
Style with Tailwind:
<IconMylogo class="h-4 text-white fill-current stroke-current stroke-1" />
See Tailwind: Working with SVG Icons.
Tip: Make sure your SVG file has only
fill="currentColor"
and/orstroke="currentColor"
attributes. never specific color.
It's nice when the icon size increase and decrease according to the font size. To do that, use em units to set the initial icon size:
<IconMylogo style="height: 0.9em; width: 1.25em;" />
Or set the size in the component:
~/components/icons/IconMylogo.vue
:
<template>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
stroke="currentColor"
class="svg-icon-inline"
+ style="height: 1.2em; width: 1.25em;"
>
<path d="M..." />
</svg>
</template>
You can find SVG icons on the internet or create one by yourself.
Resources:
- Tailwind: Resources
- heroicons (see vue-hero-icons)
- Unicons (see vue-unicons)
- Eva Icons (see vue-eva-icons)
- Feather (see vue-feather-icons)
- Material Design (see vue-ico)
- Material Design Icons (see vue-material-design-icons and mdi-vue)
- Bootstrap Icons
- Boxicons
- Tabler Icons
- Ionicons (see vue-ionicons)
- uxwing
- Octicons
- Zondicon (see vue-zondicons)
- LineIcons
- Simple Icons (brands icons)
Search all in one place: