Viet Bach Do
Viet Bach Do

Reputation: 1

Use FontAwesome on LWC

I am trying to place fontawesome icons onto my lwc component. Uploaded the zipped css file into the static resources and did referenced it in the lwc but no luck in getting this to work. Any suggestions?what is showing up instead of icon

Upvotes: 0

Views: 2080

Answers (1)

Naveen K N
Naveen K N

Reputation: 180

Unzip the downloaded file from fontawesome portal, upload the below highlighted files to your salesforce instance as static resources from css folder

enter image description here

LWC JS:

import faCss from '@salesforce/resourceUrl/faCss';
import faCss1 from '@salesforce/resourceUrl/faCss1';

LWC HTML

<template>
    <div>
        <i class="fa fa-user"></i>
    </div>
</template>

Upvotes: 1

Related Questions