I have some custom icons that I would like to use for the on and off icons instead of the fa-* collection.
Is this possible???
This goes for any icon property I guess.
Regards
Is it possible to use own icons for ToggleButton
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
You can use onIcon and offIcon properties of ToggleButton component.
Github Profile: https://github.com/mertsincan
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
After you create a custom icon name, you can add it with CSS;
You can change the above css according to yourself.
Code: Select all
onIcon="myCustomOnIcon"
//css
body .myCustomOnIcon {
background: url('...........');
background-repeat: no-repeat;
background-size: cover;
height: 1em;
width: 1.28571429em;
position: relative;
top: 2px;
}
Github Profile: https://github.com/mertsincan
-
- Posts: 15
- Joined: 04 Apr 2018, 19:45
Hey, Did you ever get this to work for you? I am trying to set the icon of the MegaMenu the same way but its not working for me.
Thanks, Shilpi
Thanks, Shilpi
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Here is a demo;
https://www.primefaces.org/primereact/#/togglebutton
If you have font-icons that would be easier.
https://www.primefaces.org/primereact/#/togglebutton
If you have font-icons that would be easier.