Search code examples
onsen-ui

I can implement icomoon icons with onsen ui?


I watched icomoon, and you can see that I can create my own icons, and down I can use with osenui but only if you use the tag class=<icon> And I realized I dare ui works with <ons-icon icon=<icon>, and can be configured to icon=<> work with icomoon?

I tried the following

<ons-icon icon="icon-icomoon"></ons-icon> //this does not help me

if I change class, if I work

 <ons-icon class="icon-icomoon"></ons-icon>

Solution

  • No, you can't easily do it using the icon attribute but as you've discovered it works if you set the class. However I don't think the size attribute will work.

    The icon attribute is a custom attribute and it doesn't do anything if the value doesn't start with "ion-" or "fa-".

    The other attributes are defined using pure CSS so they should work regardless though.

    You can check how it's done here: https://github.com/OnsenUI/OnsenUI/blob/master/framework/directives/icon.js