Top Related Projects
The iconic SVG, font, and CSS toolkit
Unicons by IconScout offers 7,000+ free 3D and animated icons plus icon fonts in line, monochrome, solid and thin line styles. Use them in your web, iOS or Android design projects.
Premium hand-crafted icons built by Ionic, for Ionic apps and web apps everywhere 🌎
Simply beautiful open-source icons
A scalable set of icons handcrafted with <3 by GitHub
A set of over 5500 free MIT-licensed high-quality SVG icons for you to use in your web projects.
Quick Overview
Vue-Awesome is a comprehensive collection of Vue.js components for Font Awesome icons. It provides an easy-to-use interface for integrating Font Awesome icons into Vue applications, offering both SVG and JS-based rendering options. The library supports all free Font Awesome 5 icons and is compatible with Vue 2 and Vue 3.
Pros
- Extensive icon collection with support for all free Font Awesome 5 icons
- Flexible rendering options (SVG and JS-based)
- Compatible with both Vue 2 and Vue 3
- Lightweight and optimized for performance
Cons
- Requires additional setup for tree-shaking to reduce bundle size
- Limited to Font Awesome icons only
- May require additional configuration for certain build systems
- Documentation could be more comprehensive for advanced use cases
Code Examples
- Basic icon usage:
<template>
<v-icon name="coffee" />
</template>
<script>
import { Icon } from 'vue-awesome'
export default {
components: {
'v-icon': Icon
}
}
</script>
- Using icon stacks:
<template>
<v-icon>
<v-icon name="circle" scale="2" />
<v-icon name="flag" inverse />
</v-icon>
</template>
- Applying transformations:
<template>
<v-icon name="user" scale="2" spin />
</template>
Getting Started
- Install the package:
npm install vue-awesome
- Import and use in your Vue component:
<template>
<div>
<v-icon name="flag" />
</div>
</template>
<script>
import { Icon } from 'vue-awesome'
export default {
components: {
'v-icon': Icon
}
}
</script>
- For global registration (in your main.js or similar):
import Vue from 'vue'
import Icon from 'vue-awesome/components/Icon'
Vue.component('v-icon', Icon)
Note: For Vue 3, use the Vue 3 compatible version and adjust the import accordingly.
Competitor Comparisons
The iconic SVG, font, and CSS toolkit
Pros of Font-Awesome
- Larger icon set with over 7,000 icons
- Supports multiple file formats (SVG, webfonts, etc.)
- Widely adopted and well-established in the web development community
Cons of Font-Awesome
- Requires additional setup and configuration for Vue.js projects
- Larger file size, which may impact performance if not optimized
- Not specifically designed for Vue.js, potentially leading to integration challenges
Code Comparison
Font-Awesome (basic usage):
<i class="fas fa-user"></i>
vue-awesome (Vue component usage):
<v-icon name="user"></v-icon>
Key Differences
- vue-awesome is specifically designed for Vue.js, offering seamless integration
- Font-Awesome provides a more extensive icon library
- vue-awesome allows for easier customization of icons within Vue components
- Font-Awesome offers more flexibility in terms of file formats and usage across different frameworks
Conclusion
Choose Font-Awesome for a comprehensive icon library with broad support, or opt for vue-awesome if you prioritize Vue.js-specific integration and simpler implementation in Vue projects. Consider factors such as project requirements, performance needs, and development workflow when making your decision.
Unicons by IconScout offers 7,000+ free 3D and animated icons plus icon fonts in line, monochrome, solid and thin line styles. Use them in your web, iOS or Android design projects.
Pros of Unicons
- Larger icon set with over 1,100 icons compared to Vue Awesome's 1,000+
- Supports multiple file formats (SVG, PNG, webfont) for greater flexibility
- Provides a Figma library for designers, enhancing workflow integration
Cons of Unicons
- Not specifically designed for Vue.js, requiring additional setup for Vue projects
- Lacks built-in Vue components, potentially requiring more code for implementation
Code Comparison
Vue Awesome usage:
<template>
<v-icon name="coffee"/>
</template>
<script>
import 'vue-awesome/icons/coffee'
</script>
Unicons usage (with Vue):
<template>
<span v-html="uniCoffee"></span>
</template>
<script>
import { uniCoffee } from '@iconscout/unicons'
</script>
Both libraries offer easy-to-use icon implementations, but Vue Awesome provides a more Vue-centric approach with custom components. Unicons requires manual HTML insertion but offers greater flexibility across different frameworks and design tools.
Premium hand-crafted icons built by Ionic, for Ionic apps and web apps everywhere 🌎
Pros of Ionicons
- Larger icon set with over 1,300 icons
- Framework-agnostic, can be used with any web technology
- Includes both iOS and Material Design style icons
Cons of Ionicons
- Requires more setup and configuration for Vue.js projects
- Larger file size due to the extensive icon set
- Less Vue-specific features and optimizations
Code Comparison
Ionicons usage:
<ion-icon name="heart"></ion-icon>
Vue Awesome usage:
<v-icon name="heart"></v-icon>
Key Differences
Vue Awesome is specifically designed for Vue.js projects, offering seamless integration and Vue-specific optimizations. It provides a smaller, curated set of Font Awesome icons, resulting in a lighter package.
Ionicons, on the other hand, offers a more extensive icon set and greater flexibility across different frameworks and technologies. It's not Vue-specific but can be used in Vue projects with additional setup.
Vue Awesome may be preferable for Vue-centric projects seeking easy integration and smaller bundle sizes. Ionicons might be a better choice for projects requiring a wider variety of icons or cross-framework compatibility.
Both libraries offer SVG-based icons, ensuring scalability and customization. The choice between them often depends on specific project requirements, desired icon set, and the importance of Vue.js optimization.
Simply beautiful open-source icons
Pros of Feather
- Lightweight and simple SVG icon set
- Framework-agnostic, can be used with any JavaScript library or framework
- Extensive collection of over 280 icons
Cons of Feather
- Limited to a single style, less customization options
- Requires additional setup for Vue.js integration
- No built-in animation support
Code Comparison
Feather usage in Vue.js:
import { feather } from 'feather-icons'
export default {
mounted() {
feather.replace()
}
}
Vue-awesome usage:
<template>
<v-icon name="github" scale="2"></v-icon>
</template>
<script>
import 'vue-awesome/icons/github'
</script>
Key Differences
- Vue-awesome is specifically designed for Vue.js, while Feather is framework-agnostic.
- Vue-awesome offers more customization options and animations out of the box.
- Feather provides a simpler, more minimalist icon set.
- Vue-awesome includes a wider variety of icon styles and sources.
- Feather requires less initial setup for non-Vue.js projects.
Both libraries have their strengths, with Feather excelling in simplicity and framework independence, while Vue-awesome offers more features and seamless Vue.js integration.
A scalable set of icons handcrafted with <3 by GitHub
Pros of Octicons
- Broader ecosystem support: Works with various frameworks and platforms
- Official GitHub icon set: Ensures consistency with GitHub's design language
- Extensive icon library: Offers a wide range of icons for different use cases
Cons of Octicons
- Less Vue-specific integration: May require additional setup for Vue projects
- Larger package size: Includes more icons, potentially increasing bundle size
- Less customization options: Primarily focused on GitHub's design system
Code Comparison
Vue-awesome usage:
<template>
<v-icon name="github"/>
</template>
<script>
import 'vue-awesome/icons/github'
</script>
Octicons usage:
<svg class="octicon octicon-mark-github" viewBox="0 0 16 16" width="16" height="16">
<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path>
</svg>
A set of over 5500 free MIT-licensed high-quality SVG icons for you to use in your web projects.
Pros of tabler-icons
- Larger icon set with over 4,200 icons compared to vue-awesome's 1,000+
- Framework-agnostic, usable in various projects beyond Vue.js
- Regular updates and active maintenance
Cons of tabler-icons
- Lacks built-in Vue.js component integration
- Requires more setup for Vue.js projects compared to vue-awesome
- No animation support out of the box
Code Comparison
vue-awesome usage in a Vue.js component:
<template>
<v-icon name="coffee" />
</template>
<script>
import 'vue-awesome/icons/coffee'
</script>
tabler-icons usage in a Vue.js component:
<template>
<svg-icon icon="coffee" />
</template>
<script>
import { coffee } from '@tabler/icons-vue'
</script>
Both repositories offer SVG-based icon solutions, but they cater to different use cases. vue-awesome is specifically designed for Vue.js projects, providing a smoother integration experience. tabler-icons, on the other hand, offers a more extensive icon set and greater flexibility across various frameworks and projects. The choice between the two depends on the specific requirements of your project and whether you need a Vue-specific solution or a more versatile icon library.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Vue-Awesome
Awesome SVG icon component for Vue.js, with built-in Font Awesome icons.
Vue-Awesome an SVG icon component for Vue.js, with built-in icons courtesy of Font Awesome.
Check out the demo here.
Installation
npm (Recommended)
$ npm install vue-awesome
bower
$ bower install vue-awesome
Manual
Just download dist/vue-awesome.js
and include it in your HTML file:
<script src="path/to/vue-awesome/dist/vue-awesome.js"></script>
Usage
<!-- basic -->
<v-icon name="beer"/>
<!-- with options -->
<v-icon name="sync" scale="2" spin/>
<v-icon name="comment" flip="horizontal"/>
<v-icon name="code-branch" label="Forked Repository"/>
<!-- stacked icons -->
<v-icon label="No Photos">
<v-icon name="camera"/>
<v-icon name="ban" scale="2" class="alert"/>
</v-icon>
Font Awesome 5 has separated all icons into several packs. Vue-Awesome is built upon its all free icons, which includes all free icons from 3 icon packs: regular
, solid
and brands
. Since the solid
pack has the most number of icons, we organize all Vue-Awesome icons as follows:
-
All icons from
solid
pack are located invue-awesome/icons
directory and have unprefixedname
prop values. -
Icons from
regular
andbrands
are located invue-awesome/icons/regular
andvue-awesome/icons/brands
, which have prefixedname
prop values likeregular/flag
orbrands/reddit
.
You can find all available name
values from Font Awesome's website like beer
, file
and camera
.
ES Modules with NPM & vue-loader (Recommended)
import Vue from 'vue'
/* Pick one way between the 2 following ways */
// only import the icons you use to reduce bundle size
import 'vue-awesome/icons/flag'
// or import all icons if you don't care about bundle size
import 'vue-awesome/icons'
/* Register component with one of 2 methods */
import Icon from 'vue-awesome/components/Icon'
// globally (in your main .js file)
Vue.component('v-icon', Icon)
// or locally (in your component file)
export default {
components: {
'v-icon': Icon
}
}
â ï¸ Heads up
Importing the souce version
If you are using official Vue CLI to create your project and you want to use the untranspiled component (import vue-awesome/components/Icon
rather than import vue-awesome
directly, to optimize bundle size, which is recommended), you'll encounter the problem that the default configuration will exclude node_modules
from files to be transpiled by Babel.
For Vue CLI 3+, add vue-awesome
into transpileDependencies
in vue.config.js
like this:
// vue.config.js
module.exports = {
transpileDependencies: [
/\bvue-awesome\b/
]
}
For Vue CLI 2 with the webpack
template, modify build/webpack.base.conf.js
like this:
{
test: /\.js$/,
loader: 'babel-loader',
- include: [resolve('src'), resolve('test')]
+ include: [
+ resolve('src'),
+ resolve('test'),
+ resolve('node_modules/vue-awesome')
+ ]
}
If you are using bare webpack config, just do similar modifications make it work.
Using with Nuxt.js
When using Vue-Awesome on the server side with Nuxt.js, it may prompt Unexpected token import
because Nuxt.js has configured an external
option by default, which prevent files under node_modules
from being bundled into the server bundle with only a few exceptions. We need to whitelist vue-awesome
in nuxt.config.js
as follows:
For Nuxt.js 2:
module.exports = {
// ...
build: {
transpile: [/^vue-awesome/]
}
}
For Nuxt.js 1:
// Don't forget to
// npm i --save-dev webpack-node-externals
const nodeExternals = require('webpack-node-externals')
module.exports = {
// ...
build: {
extend (config, { isServer }) {
// ...
if (isServer) {
config.externals = [
nodeExternals({
// default value for `whitelist` is
// [/es6-promise|\.(?!(?:js|json)$).{1,5}$/i]
whitelist: [/es6-promise|\.(?!(?:js|json)$).{1,5}$/i, /^vue-awesome/]
})
]
}
}
}
}
Unit Testing with Jest
Make sure to whitelist vue-awesome
from the transformIgnorePattern
. Add following configuation in test/unit/jest.conf.js
:
+ transformIgnorePatterns: [
+ '/node_modules(?![\\\\/]vue-awesome[\\\\/])/'
+ ],
Don't import all icons if you don't want to make unit testing slow because this will transform all icons from ES module and thus slow down the test process.
CommonJS with NPM without ES Next support
var Vue = require('vue')
// requiring the UMD module
var Icon = require('vue-awesome')
// or with vue-loader you can require the src directly
var Icon = require('vue-awesome/components/Icon')
// register component to use
AMD
require.config({
paths: {
'vue-awesome': 'path/to/vue-awesome'
}
})
require(['vue-awesome'], function (Icon) {
// register component to use
Vue.component('v-icon', Icon)
})
Global variable
The component class is exposed as window.VueAwesome
.
// register component to use
Vue.component('v-icon', VueAwesome)
Props
-
name: string
The name of the icon. It's necessary if the component isn't used as the wrapper of an icon stack. All valid names correspond to the file path relative to the
icons
directory. Notice that you may have to check the name of the icon pack after you search on FontAwesome's website. For example, you'll see a URL argument ofstyle=brands
on the detail page for500px
and the icon name will bebrands/500px
.Only free icons for FontAwesome are available by default and because the
solid
style has the most icons, we've made it the default pack so the path prefixes can be omitted.If you pass
null
to this prop, the whole component will not be rendered. -
scale: number|string
Used to adjust the size of the icon. Default to
1
. -
spin: boolean
Used to specify whether the icon is spining. Default to
false
. (Can't use together withpulse
.) -
pulse: boolean
Set the pulse effect to the icon. Default to
false
. (Can't use together withspin
.) -
inverse: boolean
If set to
true
, the color of the icon will become#fff
. Default tofalse
. -
flip: 'vertical'|'horizontal'|'both'
Used to flip the icon.
-
label: string
Set the
aria-label
for the icon if provided. -
title: string
Set the title for the icon.
The icon will have
role="presentation"
thus not accessible when neitherlabel
nortitle
exists.
Misc
If you are using vue-awesome/components/Icon
(instead of the whole bundled version), Vue-Awesome won't import a single icon by default. Do not forget to import icons you want to use.
If these caveats don't help and there are no proper workarounds in earlier issues, please feel free to file a new one.
Styling
Dynamic sizing
You can make the icons scale dynamically according to your font-size
by adding the following CSS:
.fa-icon {
width: auto;
height: 1em; /* or any other relative font sizes */
/* You would have to include the following two lines to make this work in Safari */
max-width: 100%;
max-height: 100%;
}
Colors
The icon color is inherited from the font color of the parent element by default. You can easily change it to any other color by specifying the color
property.
Local development
$ npm i
$ npm run dev
Open http://localhost:8080/demo
to see the demo.
Updating icons
Don't touch files in src/icons
but update assets/svg/*
instead and run npm run icons
to re-generate icon module files.
Registering custom icons
Simple case
You can register custom icons like this:
import Icon from 'vue-awesome/components/Icon'
Icon.register({
baidu: {
width: 23.868,
height: 26,
d: 'M3.613 13.701c2.827-.608 2.442-3.986 2.357-4.725-.138-1.139-1.477-3.128-3.296-2.971C.386 6.21.052 9.515.052 9.515c-.309 1.528.74 4.793 3.561 4.186zm3.002 5.875c-.083.238-.268.846-.107 1.375.315 1.187 1.346 1.24 1.346 1.24h1.48v-3.619H7.749c-.713.213-1.057.767-1.134 1.004zM8.86 8.035c1.562 0 2.823-1.797 2.823-4.019C11.683 1.796 10.421 0 8.86 0 7.301 0 6.036 1.796 6.036 4.016c0 2.222 1.265 4.019 2.824 4.019zm6.724.265c2.087.271 3.429-1.956 3.695-3.644.272-1.686-1.074-3.644-2.552-3.98-1.48-.339-3.329 2.032-3.497 3.578-.2 1.89.271 3.778 2.354 4.046zm5.114 9.923s-3.229-2.498-5.113-5.198c-2.555-3.981-6.185-2.361-7.399-.337-1.209 2.024-3.093 3.305-3.36 3.644-.271.334-3.9 2.293-3.095 5.871.806 3.576 3.635 3.508 3.635 3.508s2.085.205 4.504-.336c2.42-.537 4.503.134 4.503.134s5.652 1.893 7.199-1.751c1.545-3.645-.874-5.535-.874-5.535zm-9.671 5.423H7.352c-1.587-.316-2.219-1.4-2.299-1.584-.078-.188-.528-1.059-.29-2.539.686-2.219 2.642-2.379 2.642-2.379h1.956V14.74l1.666.025v8.881zm6.844-.025h-4.229c-1.639-.423-1.716-1.587-1.716-1.587v-4.677l1.716-.027v4.203c.104.447.661.529.661.529h1.742v-4.705h1.825v6.264zm5.986-12.486c0-.808-.671-3.239-3.159-3.239-2.492 0-2.825 2.295-2.825 3.917 0 1.548.131 3.71 3.227 3.641 3.096-.068 2.757-3.507 2.757-4.319z'
}
})
More advanced cases
If your SVG file has more than one path or polygon, and/or you want to have a predefined style, you can register like this:
Paths
import Icon from 'vue-awesome/components/Icon'
Icon.register({
webpack: {
width: 1200,
height: 1200,
paths: [
{
style: 'fill:#8ED6FB',
d: 'M1035.6 879.3l-418.1 236.5V931.6L878 788.3l157.6 91zm28.6-25.9V358.8l-153 88.3V765l153 88.4zm-901.5 25.9l418.1 236.5V931.6L320.3 788.3l-157.6 91zm-28.6-25.9V358.8l153 88.3V765l-153 88.4zM152 326.8L580.8 84.2v178.1L306.1 413.4l-2.1 1.2-152-87.8zm894.3 0L617.5 84.2v178.1l274.7 151.1 2.1 1.2 152-87.8z'
},
{
style: 'fill:#1C78C0',
d: 'M580.8 889.7l-257-141.3v-280l257 148.4v272.9zm36.7 0l257-141.3v-280l-257 148.4v272.9zm-18.3-283.6zM341.2 436l258-141.9 258 141.9-258 149-258-149z'
}
]
}
})
Polygons
import Icon from 'vue-awesome/components/Icon'
Icon.register({
vue: {
width: 256,
height: 221,
polygons: [
{
style: 'fill:#41B883',
points: '0,0 128,220.8 256,0 204.8,0 128,132.48 50.56,0 0,0'
},
{
style: 'fill:#35495E',
points: '50.56,0 128,133.12 204.8,0 157.44,0 128,51.2 97.92,0 50.56,0'
}
]
}
})
Raw SVG
If you are using Vue.js version prior to 2.6.0
, you need to include innersvg-polyfill before you use this feature.
import Icon from 'vue-awesome/components/Icon'
Icon.register({
'html5-c': {
width: 512,
height: 512,
raw: '<path fill="#E34F26" d="M71,460 L30,0 481,0 440,460 255,512"/><path fill="#EF652A" d="M256,472 L405,431 440,37 256,37"/><path fill="#EBEBEB" d="M256,208 L181,208 176,150 256,150 256,94 255,94 114,94 115,109 129,265 256,265zM256,355 L255,355 192,338 188,293 158,293 132,293 139,382 255,414 256,414z"/><path fill="#FFF" d="M255,208 L255,265 325,265 318,338 255,355 255,414 371,382 372,372 385,223 387,208 371,208zM255,94 L255,129 255,150 255,150 392,150 392,150 392,150 393,138 396,109 397,94z"/>'
}
})
Top Related Projects
The iconic SVG, font, and CSS toolkit
Unicons by IconScout offers 7,000+ free 3D and animated icons plus icon fonts in line, monochrome, solid and thin line styles. Use them in your web, iOS or Android design projects.
Premium hand-crafted icons built by Ionic, for Ionic apps and web apps everywhere 🌎
Simply beautiful open-source icons
A scalable set of icons handcrafted with <3 by GitHub
A set of over 5500 free MIT-licensed high-quality SVG icons for you to use in your web projects.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot