font-awesomereact-font-awesome

How can I use outlined icons with react-fontawesome?


Basically I'm trying to use two icons:

  1. <i class="fas fa-heart"></i> Solid heart icon

  2. <i class="far fa-heart"></i> Regular heart icon (outlined)

The first one I got with the following code:

<FontAwesomeIcon icon={faHeart} />

How can I get the second one?


Solution

  • After some reading in the react-fontawesome docs I figured out how to do outlined icons.

    For the first one I need the package @fortawesome/free-solid-svg-icons Then I need to import the icons as the following:

    import { faHeart, faTrash } from '@fortawesome/free-solid-svg-icons'

    The second one, I need the package @fortawesome/free-regular-svg-icons

    Then I just import the following.

    import { faHeart as farHeart } from '@fortawesome/free-regular-svg-icons'

    That's it!