Get more control over rendering and features with our Javascript API.

Advertisement

Access the API

There are two ways to access the API depending on how you've integrated Font Awesome into your project.

Using Node.js

Set Up Package Access

Before you install the SVG Core Package, you'll need to set up access to npm.fontawesome.com:

If you're using Node.js, the @fortawesome/fontawesome-svg-core NPM package exports methods that can be used to perform various tasks.

Start by installing the Font Awesome SVG Core package:

npm install @fortawesome/[email protected]

Then you can tap into the API from within your app or project:

import { library, icon } from '@fortawesome/fontawesome-svg-core'
import { faCamera } from '@fortawesome/free-solid-svg-icons'

library.add(faCamera)

const camera = icon({ prefix: 'fas', iconName: 'camera' })
Advertisement

In the Browser

Or you can access the API directly in the browser where Font Awesome is available as a global namespace.

var camera = window.FontAwesome.icon({ prefix: 'fas', iconName: 'camera' })

What's the difference between packages?

While all of the API methods are available through both the Font Awesome and the Font Awesome SVG Core packages, each package has a different default configuration.

Option Font Awesome (JavaScript) Font Awesome SVG Core (JavaScript)
Automatically replaces <i> tags with <svg>
Adds CSS to the <head> to provide styles for the icons
Watches the page (opens new window) for icon changes and additions

You're viewing the Version 6 Beta

It's all the awesome of 5, but now more six-y! Version 6 brings over 13,000 icons across 5 styles – including the new Thin style! – and includes more and faster services.

Get the Deets on Version 6

Head Back to Our Current Version 5 Release

Need a Hand?

If you’re stuck or have a question, check our Troubleshooting docs, all of the Font Awesome threads on Stack Overflow, or contact our community on GitHub.

Or get Real Human Support™ with a Pro Subscription!