vue-fontawesome
Font Awesome 5 Vue component
Installation
$ npm i --save @fortawesome/fontawesome
$ npm i --save @fortawesome/vue-fontawesome
or
$ yarn add @fortawesome/fontawesome
$ yarn add @fortawesome/vue-fontawesome
Usage
The basics
The icon
property of the FontAwesomeIcon
component can be used in the following way:
Shorthand that assumes a prefix of fas
:
Explicit prefix (note the Vue bind shorthand because this uses an array):
Explicit icon definition (this is pseudo-code, see examples below for more detail):
Using it with Vue
Using an explicit icon offers the advantage of only bundling the icons that you
use in your final bundled file. This allows us to subset Font Awesome's
thousands of icons to just the small number that are normally used.
Import the specific icons that you need:
It can be tedious to always import the icons individually so a library can be
configured and shorthand can be used when rendering the icon.
Define a library that can be used without explicit imports:
App.js
FAExample.vue
Features
Basic
Spin and pulse animation:
Fixed width:
Border:
List items:
Flip horizontally, vertically, or both:
Size:
Rotate:
Pull left or right:
Advanced
Power Transforms:
Masking:
Symbols: