Hi,
I need to make swap out icons in various components. Can you please advise the recommended way to override icons (both prime icons and external)?
Some of the components I'm hoping to change the icons for:
- checkbox
- sidebar close
- panelmenu
Thanks!
Changing component icons
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Sorry for the delay, there is a reorg going on this week in our support team so caused this delay. We'll assist shortly.
Hi,
You can override icons by the below steps;
1. add the package and version you want to in package.json file.
2. add css file of this package in angular.json file. like;
3. create a @mixin in your stylesheet (stylesheet.scss or _mixin.scss) like the following code;
or
4.add code like the following code to where you want to override the code;
For Fontawesome
or for PrimeIcons
5. Lastly regenerate your css files with 'sass -s src/assets --sourcemap=none'
You can override icons by the below steps;
1. add the package and version you want to in package.json file.
2. add css file of this package in angular.json file. like;
Code: Select all
"styles": [
"node_modules/primeng/resources/primeng.min.css",
"node_modules/primeicons/primeicons.css",
"node_modules/font-awesome/css/font-awesome.min.css",
//other style files
],
Code: Select all
@mixin icon-override_fa($icon) {
background: none;
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-indent: 0px !important;
text-align: center;
&:before {
content: $icon;
}
}
Code: Select all
@mixin icon-override_pi($icon) {
background: none !important;
font-family: 'primeicons';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
display: inline-block;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-indent: 0px !important;
text-align: center;
&:before {
content: $icon;
}
}
For Fontawesome
Code: Select all
.ui-chkbox {
.ui-chkbox-box {
.ui-chkbox-icon {
@include icon_override_fa("\f0d7");
}
}
}
Code: Select all
.ui-chkbox {
.ui-chkbox-box {
.ui-chkbox-icon {
@include icon-override_pi("\e90f");
}
}
}
-
- Information
-
Who is online
Users browsing this forum: No registered users and 5 guests