import icons from Font Awesome

UI Components for React
Post Reply
arturreyes
Posts: 2
Joined: 09 Nov 2021, 13:46

09 Nov 2021, 14:28

Hi, I'm trying to import icons from Font Awesome to the menu, but the menu only accepts strings, so I can't import it, someone knows how to do it, thanks

fpw23
Posts: 1
Joined: 15 Oct 2021, 13:18

10 Nov 2021, 00:34

try using the font awesome string instead of the pi string like this

"fas fa-exclamation-triangle"

instead of

"pi pi-exclamation-triangle"

you will also have to load the font awesome css and font files in your html

Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

11 Nov 2021, 03:56

I use Fontawesome with PrimeReact. What does not work?

You should be able to replace anywhere they use PrimeIcons like pi pi-filter fas fa-search for example.

How are you importing FontAwesome?
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

11 Nov 2021, 13:41

Just add fontawesome to your package.json like this...

Code: Select all

@fortawesome/fontawesome-free": "5.15.4"
And in your app class just import it...

Code: Select all

import 'primereact/resources/primereact.min.css';
import 'primeicons/primeicons.css';
import 'primeflex/primeflex.min.css';
import '@fortawesome/fontawesome-free/css/all.min.css';
import './App.scss';


const App = () => {
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests