npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ui4ngx/fontawesome

v9.5.2

Published

Another Angular way to display FontAwesome (v5+).

Downloads

16

Readme

NOTE: This library supports only FontAwesome version 5+. If you are using FontAwesome 4, please use @ui4ngx/fontawesome4.

@ui4ngx/fontawesome

npm Version Build Status

Another Angular way to display FontAwesome (v5+)

Demo

Check out the demo.

Install

1. Install Packages

npm install @fortawesome/fontawesome-free@^5.15.4

npm install @ui4ngx/fontawesome

2. Import the module:

There are multiple ways to use FontAwesome v5+.

Both WebFont and SVG icons are available since version 5 and each type can be used independently or together.

The following is how to set up your project to use WebFont or SVG or both.

2.1 Using WebFont Icons

2.1.1. Install CSS Styles and Web Fonts

If you want to manually install FontAwesome 5+, the free package can be downloaded at https://fontawesome.com/download

Clicking on [Free For Web] under Font Awesome 5 section, you will be able to get this file fontawesome-free-5.15.4-web.zip

Extract the ZIP file and copy CSS and WebFont files to assets/css and assets/webfonts folder respectively._

Project structure

src/           
|- assets/
|  |- css/
|      |- all.css  <-- from zip file downloaded earlier.
|  |- webfonts/
|      |- fa-brands-400.eot   <-- the following are required for Brand icons ('fab' prefix)
|      |- fa-brands-400.svg
|      |- fa-brands-400.ttf
|      |- fa-brands-400.woff
|      |- fa-brands-400.woff2
|      |- fa-regular-400.eot  <-- the following are required for Regular icons ('far' prefix)
|      |- fa-regular-400.svg
|      |- fa-regular-400.ttf
|      |- fa-regular-400.woff
|      |- fa-regular-400.woff2
|      |- fa-solid-900.eot    <-- the following are required for Solid icons ('fas' prefix)
|      |- fa-solid-900.svg
|      |- fa-solid-900.ttf
|      |- fa-solid-900.woff
|      |- fa-solid-900.woff2
|  +- ...      

If you're using Angular CLI, add to styles inside the angular.json (Angular CLI v6.0.0+) or angular-cli.json (older version of Angular CLI)

{
    "styles":
    [
        // if download Font Awesome package manually
        "src/assets/css/all.css",
        // if install Font Awesome package with npm
        "node_modules/@fortawesome/fontawesome-free/css/all.css", 
        "node_modules/@ui4ngx/fontawesome/css/ngx-fontawesome.scss"
    ]
}

If you're NOT using the CLI, import the stylesheet to your index.html file. This way CSS styles and Web Fonts will be downloaded automatically.

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css">

2.1.2. Import the module

import { NgxFontAwesomeModule } from '@ui4ngx/fontawesome';

@NgModule({
  //...
  imports: [
    //...
    NgxFontAwesomeModule
  ],
  //...
})
export class AppModule { }

2.2 Using SVG Icons

2.2.1. Install CSS Styles

If you want to manually install FontAwesome 5+, the free package can be downloaded at https://fontawesome.com/download

Clicking on [Free For Web] under Font Awesome 5 section, you will be able to get this file fontawesome-free-5.15.4-web.zip

Extract the ZIP file and copy svg-with-js.css file to assets/css folder.

Project structure

src/           
|- assets/
|  |- css/
|      |- svg-with-js.css  <-- from zip file downloaded earlier 
|  +- ...      

If you're using Angular CLI, add to styles inside the angular.json (Angular CLI v6.0.0+) or angular-cli.json (older version of Angular CLI)

{
    "styles":
    [
        // if download Font Awesome package manually
        "src/assets/css/svg-with-js.css",
        // if install Font Awesome package with npm
        "node_modules/@fortawesome/fontawesome-free/css/svg-with-js.css", 
        "node_modules/@ui4ngx/fontawesome/css/ngx-fontawesome.scss"
    ]
}

If you're NOT using the CLI, import the stylesheet to your index.html file

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/svg-with-js.css">

2.2.2. Install SVG Definitions

npm install --save @fortawesome/free-brands-svg-icons

npm install --save @fortawesome/free-regular-svg-icons

npm install --save @fortawesome/free-solid-svg-icons

2.2.3. Import the module

//...
import { NgxFontAwesomeModule } from '@ui4ngx/fontawesome';
import { fas } from '@fortawesome/free-solid-svg-icons';
import { far } from '@fortawesome/free-regular-svg-icons';
import { fab } from '@fortawesome/free-brands-svg-icons';

@NgModule({
  //...
  imports: [
    //...
    NgxFontAwesomeModule
  ],
  declarations: [ AppComponent ],
  bootstrap: [ AppComponent ],
  providers: [
    {provide: 'fab', useValue: fab},
    {provide: 'far', useValue: far},
    {provide: 'fas', useValue: fas},
    // @ui4ngx/fontawesome options
    {provide: 'ngxFontAwesome', useValue: {svgSupport: true, prefix: ['far', 'fas', 'fab']}}
  ]
  //...
})
export class AppModule { }

NgxFAOptions

Name | Type | Default value | Optional --- | --- | --- | --- prefix | String[] | [] | Yes svgSupport| Boolean | false | Yes

If you're using SystemJS, add to systemjs.config.js

{
    map: {
        '@fortawesome/free-brands-svg-icons': 'npm:@fortawesome/free-brands-svg-icons/index.js',
        '@fortawesome/free-solid-svg-icons': 'npm:@fortawesome/free-solid-svg-icons/index.js',
        '@fortawesome/free-regular-svg-icons': 'npm:@fortawesome/free-regular-svg-icons/index.js',
    }
}

Features

<fa> Component

Note: This component only works when your project is configured to work with WebFont icons

Attributes

Name | Type | Options | Optional --- | --- | --- | --- prefix | String | far, fas, fab | No name | String | Icon name | No title | String | Tooltip to display when hovered | Yes alt | String | Text alternative to support screen reader | Yes animation | String | spin, pulse | Yes cssClass | String | Additional CSS classes | Yes pull | String | left, right | Yes scale | Number | 2 - 10 | Yes size | String | lg, sm, xs | Yes stack | Number | 1,2 | Yes rotate | Number | 90, 180, 270 | Yes rotateBy | Number | Angle in degree, etc 45, 30,... | Yes flip | String | horizontal, vertical, both | Yes border | Boolean | true, false | Yes fixedWidth| Boolean | true, false | Yes inverse | Boolean | true, false | Yes

Syntax

<fa prefix="far|fas|fab"
        name="..."
        title="Text to show when hovered"
        alt="Text alternative for screen reader"
        cssClass="..."
        pull="left|right"
        scale="2|3|4|5|6|7|8|9|10"
        size="xs|sm|lg"
        stack="1|2"
        rotate="90|180|270"
        rotateBy="45"
        flip="horizontal|vertical|both"
        animation="pulse|spin"
        border="true"
        fixedWidth="true"
        inversed="true"></fa>

<fa-svg> Component

Note: This component only works when your project is configured to work with SVG icons.

Attributes

Name | Type | Options | Optional --- | --- | --- | --- prefix | String | far, fas, fab | No name | String | Icon name | No title | String | Tooltip to display when hovered | Yes alt | String | Text alternative to support screen reader | Yes animation | String | spin, pulse | Yes cssClass | String | Additional CSS classes | Yes shrink | Number | 8, 16,32, ... (1/16em) | Yes grow | Number | 8, 16,32, ... (1/16em) | Yes up | Number | 8, 16,32, ... (1/16em) | Yes down | Number | 8, 16,32, ... (1/16em) | Yes left | Number | 8, 16,32, ... (1/16em) | Yes right | Number | 8, 16,32, ... (1/16em) | Yes rotate | Number | Angle in degree, etc 45, 30,... | Yes flip | String | horizontal, vertical, both | Yes inverse | Boolean | true, false | Yes maskPrefix| String | Prefix (far, fas, fab) for mask icon | Yes maskName | String | Name for mask icon | Yes

Syntax

<fa-svg prefix="far|fas|fab"
        name="..."
        title="Text to show when hovered"
        alt="Text alternative for screen reader"
        cssClass="..."
        shrink="8"
        grow="16"
        up="32"
        down="32"
        left="16"
        right="16"
        rotate="45"
        flip="horizontal|vertical|both"
        animation="pulse|spin"
        inversed="true"
        maskPrefix="far|fas|fab"
        maskName="..."></fa-svg>

[faLayersText] Directive

Note: This Utility directive provides support to FontAwesome by adding transformations (scaling, translation and rotation) to text. It will work regardless of supporting icon type.

Attributes

Name | Type | Options | Optional --- | --- | --- | --- shrink | Number | 8, 16,32, ... (1/16em) | Yes grow | Number | 8, 16,32, ... (1/16em) | Yes up | Number | 8, 16,32, ... (1/16em) | Yes down | Number | 8, 16,32, ... (1/16em) | Yes left | Number | 8, 16,32, ... (1/16em) | Yes right | Number | 8, 16,32, ... (1/16em) | Yes rotate | Number | Angle in degree, etc 45, 30,... | Yes flip | String | horizontal, vertical, both | Yes

Syntax

<span faLayersText 
        shrink="8"
        grow="16"
        up="32"
        down="32"
        left="16"
        right="16"
        rotate="45"
        flip="horizontal|vertical|both"
        ...
        ></span>

NPM version explained

NPM Version will be used to identify

####For example:

Version | Angular Version | Font Awesome Version | Library version --- | --- | --- | --- 5.5.1 | ^5.0.0 | Support v5+ (^5.15.4) | 1 Initial commit 7.5.2 | ^7.0.0 | Support v5+ (^5.15.4) | 2 Etc. Bug fixes and improvements ... ... | ... | ... | ... 8.5.10 | ^8.0.0 | Support v5+ (^5.15.4) | 10 Etc. Upgrade and new feature ... 8.6.10 | ^8.0.0 | Support v6+ | 10 Etc. Upgrade and new feature ... 9.6.11 | ^8.0.0 | Support v6+ | 11 Etc. Upgrade and new feature ...

You got the idea.

TODO

  • Add Dual-Tone FontAwesome (fad) support.
  • Add unit tests and integration test
  • Improve demo page

License

MIT © Tuyen T Tran