Import Icons
Ready to reference icons? Here’s a primer on Font Awesome icon naming and how to import from icon content packages.
Referencing Icons
We recommend referencing icons in your HTML with a dedicated element you’ll use only for icons. We find the <i>
tag perfect for the job. That element will contain: 1) Font Awesome specific style prefix (e.g. fa-solid
), and 2) the icon’s name (prefixed with fa-
) you want to display.
Families + Styles
There are three families of Font Awesome icons - each with a unique look, class name, and @font-face
font-family. In both Font Awesome Classic and Sharp, there are five styles of Font Awesome icons. Here are some examples:
Classic Family
Style | Availability | Code |
---|---|---|
Solid | Free Plan | <i class="fa-solid fa-user"></i> |
Regular | Pro only | <i class="fa-regular fa-user"></i> |
Light | Pro only | <i class="fa-light fa-user"></i> |
Thin | Pro only | <i class="fa-thin fa-user"></i> |
Brands | Free Plan | <i class="fa-brands fa-font-awesome"></i> |
Duotone Family
Style | Availability | Code |
---|---|---|
Solid | Pro only | <i class="fa-duotone fa-solid fa-user"></i> |
Regular | Pro only | <i class="fa-duotone fa-regular fa-user"></i> |
Light | Pro only | <i class="fa-duotone fa-light fa-user"></i> |
Thin | Pro only | <i class="fa-duotone fa-thin fa-user"></i> |
Sharp Family
Style | Availability | Code |
---|---|---|
Solid | Pro only | <i class="fa-sharp fa-solid fa-user"></i> |
Regular | Pro only | <i class="fa-sharp fa-regular fa-user"></i> |
Light | Pro only | <i class="fa-sharp fa-light fa-user"></i> |
Thin | Pro only | <i class="fa-sharp fa-thin fa-user"></i> |
Sharp Duotone Family
Style | Availability | Code |
---|---|---|
Solid | Pro only | <i class="fa-sharp-duotone fa-solid fa-user"></i> |
Regular | Pro only | <i class="fa-sharp-duotone fa-regular fa-user"></i> |
Light | Pro only | <i class="fa-sharp-duotone fa-light fa-user"></i> |
Thin | Pro only | <i class="fa-sharp-duotone fa-thin fa-user"></i> |
Icon content “encoded” in JavaScript packages
The first version of Font Awesome used web fonts to encode icon data into a container the browser could use. In Version 5, we added support for SVG which lets us do some fun things with icon data.
Scalable Vector Graphics (SVGs) are made up of text information that can include paths. We use the path data to draw the icons.
Here’s an example from our code
icon:
Since it’s just text, we can easily store this information in JavaScript files. This can be easier to deal with in some projects versus web font files and CSS.
SVG Icon Package names
Icon content packages are segmented by license and style:
Package name | Style | Prefix | Example | Availability |
---|---|---|---|---|
@fortawesome/free-solid-svg-icons | Solid | fa-solid | Free | |
@fortawesome/free-regular-svg-icons | Regular | fa-regular | Free | |
@fortawesome/free-brands-svg-icons | Brands | fa-brands | Free | |
@fortawesome/pro-solid-svg-icons | Solid | fa-solid | Pro only | |
@fortawesome/pro-regular-svg-icons | Regular | fa-regular | Pro only | |
@fortawesome/pro-light-svg-icons | Light | fa-light | Pro only | |
@fortawesome/pro-thin-svg-icons | Thin | fa-thin | Pro only | |
@fortawesome/pro-duotone-svg-icons | Duotone | fa-duotone | Pro only | |
@fortawesome/duotone-regular-svg-icons | Duotone Regular | fa-duotone fa-regular | Pro only | |
@fortawesome/duotone-light-svg-icons | Duotone Light | fa-duotone fa-light | Pro only | |
@fortawesome/duotone-thin-svg-icons | Duotone Thin | fa-duotone fa-thin | Pro only | |
@fortawesome/sharp-solid-svg-icons | Sharp Solid | fa-sharp fa-solid | Pro only | |
@fortawesome/sharp-regular-svg-icons | Sharp Regular | fa-sharp fa-regular | Pro only | |
@fortawesome/sharp-light-svg-icons | Sharp Light | fa-sharp fa-light | Pro only | |
@fortawesome/sharp-thin-svg-icons | Sharp Thin | fa-sharp fa-thin | Pro only | |
@fortawesome/sharp-duotone-solid-svg-icons | Sharp Duotone Solid | fa-sharp-duotone fa-solid | Pro only | |
@fortawesome/sharp-duotone-regular-svg-icons | Sharp Duotone Regular | fa-sharp-duotone fa-regular | Pro only | |
@fortawesome/sharp-duotone-light-svg-icons | Sharp Duotone Light | fa-sharp-duotone fa-light | Pro only | |
@fortawesome/sharp-duotone-thin-svg-icons | Sharp Duotone Thin | fa-sharp-duotone fa-thin | Pro only |
Pro packages requires some extra configuration to allow NPM to install.
Icon names
JavaScript naming doesn’t use hyphens; it uses lower camel case. So here are some basic examples of
how imports
and requires
work.
Icon name | Version 4 name | Lower camel case | Notes on usage |
---|---|---|---|
address-book | fa-address-book | faAddressBook | The “B” is captialized after the hyphen |
facebook-f | fa-facebook | faFacebookF | It’s in the Brands style and this was renamed to facebook-f |
circle | fa-circle-o | faCircle | Outline versions of icons are now in the Regular and Light styles |
freebsd | fa-freebsd | faFreebsd | OCD-warning: we know it’s FreeBSD but consistency/guessability is the goal here |
Importing these specific icons:
Import all icons by using the prefix:
To import the same icon from different styles: