Hi I need help to upload the font awesome icons and use them in LWC. Please guide me. Thanks
3 risposte
Please check this once
HTML File:-<template>
<i class="fa-solid fa-bars"></i>
</template>
JavaScript File:-
import { LightningElement } from 'lwc';
import { loadStyle } from 'lightning/platformResourceLoader';
import Fontawesome from '@salesforce/resourceUrl/BootstapCDN';
export default class PortfolioFooter extends LightningElement {
renderedCallback() {
Promise.all([
loadStyle(this, Fontawesome + '/css/all.css')
]).then(() => {
console.log( 'Files loaded' );
})
.catch(error => {
console.log( error.body.message );
});
}
}
Reference link:-
https://salesforce.stackexchange.com/questions/309305/how-to-make-font-awesome-icons-work-on-lightning-web-componentsHope this helps
Thanks