Icons
Vuetify comes bootstrapped with support for Material Icons, Material Design Icons, Font Awesome 4 and Font Awesome 5. By default, applications will default to use Google's Material Icons.
Uso
In order to change your font library, add the iconfont
option during instantiation.
Using a predefined option will prefill defaults based upon the selected preset. This will overwrite the defaults of components that have default icon values. Click here to view icon values by preset.
Installing fonts
You are required to include the specified icon library (even if using default). This can be done by including a CDN link or importing the icon library into your application
Install Material Icons
This is the default icon font for Vuetify. For projects without a build process, it is recommended to import the icons from CDN
Alternatively, it is possible to install locally using yarn or npm. Keep in mind that this is not an official google repository and may not receive updates
Once you have installed the package, import it into your main entry js file. This is typically the main.js
, index.js
or app.js
located in your src/
folder. If you are using an SSR application, you may have a client.js
or entry-client.js
file.
Install Material Design Icons
Installation is the same as the above. You will need to import the library into your application.
Install Font Awesome 5 Icons
The easiest way to get started with FontAwesome is to use a cdn. Within the head of your main index.html
place this snippet:
To install locally you can pull in the Free version of FontAwesome using your preferred package manager:
Within your main entry point, simply import the package's all.css. If you are using a configured webpack project, you will need to setup support for .css
files using the webpack css loader. If you are already using vue-cli-3, this is done for you automatically.
Install Font Awesome 4 Icons
Same as above. Installing FontAwesome through cdn is the easiest way to check it out within your project:
Installing FontAwesome4 is the same as its newer version, just from a different repository. You will be targeting the font-awesome
repo as opposed to @fortawesome
one.
Don't forget, your project will need to recognize css. If you are using webpack, install and setup the css loader.
Install Font Awesome SVG Icons
Add required dependencies.
Then add globally font-awesome-icon
component and set faSvg
as iconfont in Vuetify config.
Using custom icons
Let's say your application calls for a custom icon in a Vuetify component. Instead of creating a wrapper component or manually defining the specific icon each time a component appears, you can configure it at a global level.
Let's say your application calls for a custom icon in a Vuetify component. Instead of creating a wrapper component or manually defining the specific icon each time a component appears, you can configure it at a global level.
Reusable custom icons
Vuetify will automatically merge any icon strings provided into the pool of available presets. This allows you to create custom strings that can be utilized in your application by simply referencing the global icons.
This can help ensure your application is always using a specific icon given a provided string. Here are a few ways that you can use <v-icon>
with this system.
Custom components
You can utilize the same icon strings in your own custom components. Any time $vuetify.icons is passed in through v-text, v-html or as text, <v-icon>
will look up that specified value. This allows you to create customized solutions that are easy to build and easy to manage.
Custom Font Awesome Pro Icons
You can utilize component icons with Font Awesome Pro to select individual icon weights:
Component icons
Instead of provided icon fonts presets you can use your own component icons. You also can switch icons that are used in Vuetify component with your own.
If you want your SVG icon to inherit colors and scale correctly - be sure add the following css to it: