Professional Documents
Culture Documents
How To Use Custom Icons On Ionic 3 - Yann Braga
How To Use Custom Icons On Ionic 3 - Yann Braga
HOME
CONTACT
Search
ABOUT ME
G e t t i n g the icons
Ionic custom compon
First of all, youve got to get your SVG icons. If you
already have your icons or dont want to pick
https://yannbraga.com/2017/06/28/how-to-use-custom-icons-on-ionic-3/ 1/11
9/7/2017 How to use custom icons on Ionic 3 Yann Braga
March 2017
C AT E G O R I E S
custom icons
hackathon
Generating our new font
After downloading the desired icons, we are going to
input properties
use an app called Icon Moon, which basically can turn
a set of SVG icons into a font that a browser can Introduction
easily understand. This app already has a few sets of
icons (most of which are free), so if you havent ionic2
picked your SVGs from somewhere else, you can get
from there (you can browse its icon library). ionic3
https://yannbraga.com/2017/06/28/how-to-use-custom-icons-on-ionic-3/ 2/11
9/7/2017 How to use custom icons on Ionic 3 Yann Braga
The icon names will be the name of our svg files. I like
to have a way to distinguish between custom and
default stuff, so the icons will all have a prefix of ai-
(amazing icons). In this screen we can change the
icon names, and also their content code. After setting
everything up, we press the Download button at the
right bottom corner and thats it! The app will generate
our webfont with all those nice icons.
1 .ai-pacman:before ,
2 .ion-ios-ai-pacman:before ,
3 .ion-ios-ai-pacman-outline:before ,
4 .ion-md-ai-pacman:before ,
5 .ion-md-ai-pacman-outline:before {
6 content: '\e916';
7 font-size: 26px;
8 }
9
10
11 .ai-rock:before ,
12 .ion-ios-ai-rock:before ,
13 .ion-ios-ai-rock-outline:before ,
14 .ion-md-ai-rock:before ,
15 .ion-md-ai-rock-outline:before {
16 content: '\e905';
17 font-size: 26px;
18 }
Did you notice how poluted this gets? For each and
every icon, we had to add 8 lines of code. I wonder
how many lines we would have to write for over 30-50
icons.. Nah, too much work.
https://yannbraga.com/2017/06/28/how-to-use-custom-icons-on-ionic-3/ 4/11
9/7/2017 How to use custom icons on Ionic 3 Yann Braga
To this:
https://yannbraga.com/2017/06/28/how-to-use-custom-icons-on-ionic-3/ 5/11
9/7/2017 How to use custom icons on Ionic 3 Yann Braga
1 // In order to make custom icons work and not break ionic icons, change ionic.ionicon
2 // @import "ionic.ionicons";
3 @import "ionicons";
https://yannbraga.com/2017/06/28/how-to-use-custom-icons-on-ionic-3/ 6/11
9/7/2017 How to use custom icons on Ionic 3 Yann Braga
Thats it! I hope you guys find this tutorial useful, and
please let me know in case of any questions.
YOU M AY A L S O LIKE
https://yannbraga.com/2017/06/28/how-to-use-custom-icons-on-ionic-3/ 7/11
9/7/2017 How to use custom icons on Ionic 3 Yann Braga
IONI C C U S TOM
COMP O N E NTS
AND T E M PLATES
June 2, 2017
Sort by Best
Recommend 4 Share
global packages:
@ionic/cli-utils : 1.5.0
Cordova CLI : 7.0.1
Gulp CLI : CLI version 3.9.1 Local version 3.9.1
Ionic CLI : 3.5.0
local packages:
@ionic/app-scripts : 2.0.0
see more
https://yannbraga.com/2017/06/28/how-to-use-custom-icons-on-ionic-3/ 8/11
9/7/2017 How to use custom icons on Ionic 3 Yann Braga
see more
Reply Share
Also check if you have your paths correctly, like Max Helskens
did on the previous comment.
In case you can't fix the issue, please upload a sample of the
project so I can assist you better.
Cheers!
Reply Share
Cheers!
Reply Share
If that wasn't the case, feel free to push a sample repo on github
then paste the link here, I'll gladly help you :)
Cheers!
Reply Share
@import "../theme/icons";
i got this
http://prntscr.com/fx2kc9
so i must write
@import "../theme/icons.scss";
https://yannbraga.com/2017/06/28/how-to-use-custom-icons-on-ionic-3/ 11/11