Skip to content

Getting Started

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

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

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:

Terminal window
npm install @fortawesome/fontawesome-svg-core

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(...all)
const camera = icon({ prefix: 'fas', iconName: 'camera' })

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' })

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.

OptionFont 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 for icon changes and additions