React-fontawesome: Pro icons not showing

Created on 10 Jun 2018  路  4Comments  路  Source: FortAwesome/react-fontawesome

Hello,
I have used pro-icons with NPM before in a WordPress theme (Sage) and I have put the authToken on the .npmrc file as per the instruction provided and it worked. Now I have done the same thing in a React project but the pro icons don't work.

import { library } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faSpinner } from '@fortawesome/pro-light-svg-icons';

library.add(faSpinner);

<FontAwesomeIcon icon="spinner" spin size="3x" />

I have the .npmrc file in place and I have even set the authToken globally but pro-light and pro-regular don't work. If I import them from 'pro-solid-svg-icons' they work (and of course the free-solid as well).

Any idea?

Most helpful comment

I just ran into this issue too (trying to use a Pro light icon). If you're working the library approach, pass an array to the FontAwesomeIcon:

<FontAwesomeIcon icon={["fal", "spinner"]} />

The default is "fas".

38

All 4 comments

Ok sorry, turns out that I should have used the other syntax using curly brackets
<FontAwesomeIcon icon={faSpinner} spin size="3x" />

I just ran into this issue too (trying to use a Pro light icon). If you're working the library approach, pass an array to the FontAwesomeIcon:

<FontAwesomeIcon icon={["fal", "spinner"]} />

The default is "fas".

38

I was just about to reach for the scotch.... thanks

Yepp, for Vue please use <font-awesome-icon :icon="['fal', 'spinner']" />, thanks @5tormTrooper.

Was this page helpful?
0 / 5 - 0 ratings