Search code examples
nativescriptfont-awesome

How to correctly use font awesome icons in a nativescript application


I have this defined in my app.scss

.fas {
font-family: 'Font Awesome 5 Free', 'fa-solid-900';
font-weight: 900;
}

and am trying to use an icon like this

<Button class="btn fas" text="&#xf095;"></Button>

in my app. which renders as

enter image description here

from my reading this should work, but I am obviously missing some config item. Any ideas what I could be missing?


Solution

  • I've had more luck using the following format of the code when using icon fonts.

    const icon = String.fromCharCode(0xf095);
    
    <Button class="btn fas" [text]="icon"></Button>