• Stars
    star
    670
  • Rank 67,354 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A React Font Awesome component.

react-fontawesome

styled with prettier Travis CI build status Dependency Status View on npm View on npm

A React component for the font-awesome icon library.

If you are using Font Awesome v5+, please use the official React component!. react-fontawesome does not support FontAwesome v5!

This project is no longer actively maintained. Please try and use the official component above if you are able!

Install

npm install --save react-fontawesome

Note: This component does not include any of the Font Awesome CSS or fonts, so you'll need to make sure to include those on your end somehow, either by adding them to your build process or linking to CDN versions.

Using CDN version

The fastest way to get started is to import FontAwesome with a link tag in your page's <head>:

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />

You can change the version number to use whatever version of FontAwesome you'd like.

Using with Webpack

If you're using WebPack, you will need to install FontAwesome, import the FontAwesome Sass/Less, and configure the font path. Please see this blog post on how to get Webpack and FontAwesome working together.

Usage

var React = require('react')
var FA = require('react-fontawesome')

React.render(<FA name="rocket" />, document.body)

Features

  • No dependencies (other than React)
  • Simple API that mirrors Font Awesome's class names.
  • Supports all Font Awesome modifiers (see API below).
  • Make use of Css Modules
  • Add your own classNames, styles and other props (all additional props are passed directly to the component).

Examples

Regular usage

var React = require('react')
var FontAwesome = require('react-fontawesome')

var MyComponent = React.createClass({
  render: function() {
    return (
      <FontAwesome
        className="super-crazy-colors"
        name="rocket"
        size="2x"
        spin
        style={{ textShadow: '0 1px 0 rgba(0, 0, 0, 0.1)' }}
      />
    )
  },
})

With the use of CSS Modules

import React from 'react'
import FontAwesome from 'react-fontawesome'
import faStyles from 'font-awesome/css/font-awesome.css'

var MyComponent = React.createClass({
  render: function() {
    return (
      <FontAwesome
        className="super-crazy-colors"
        name="rocket"
        cssModule={faStyles}
        size="2x"
        spin
        style={{ textShadow: '0 1px 0 rgba(0, 0, 0, 0.1)' }}
      />
    )
  },
})

The above will create output like this:

<span class="font-awesome__fa___2otTb font-awesome__fa-rocket___lfSov font-awesome__super-crazy-colors___3k583"></span>

API

See the API docs for full documentation.

Contributing

Pull requests welcome!

Run the test suite with npm test and format your code with npm run format. Make sure tests are passing and that you write tests for new features and document changes to the API with updates to the JSDocs.

Before you submit your pull request, run npm run dist to build the project and commit the changes.

License

MIT Β© Dana Woodman

More Repositories

1

docker-node-hello-world

Docker + Node "Hello World" example repo for Docker beginners.
JavaScript
70
star
2

sveltekit-auth-example

An example SvelteKit app implementing a simple authentication system.
TypeScript
69
star
3

sinon-express-mock

Simple request and response mock objects to pass into Express routes when testing using Sinon.
JavaScript
47
star
4

starter

[NOT MAINTAINED] A robust starter application using React, Socket.io, Browserify, LESS, Mocha and much more.
JavaScript
18
star
5

django-flatpages-plus

[NOT MAINTAINED] A more robust flatpages app for Django.
Python
17
star
6

python-uptime-monitor

[NOT MAINTAINED] Monitor a url to see if it is online. If it is does not return a 200 code, then (optionally) send an email out through GMail.
Python
16
star
7

django-reviews

[NOT MAINTAINED] Generic Django reviews that can work on any model.
Python
13
star
8

google-sketchup-file-downloader

[NOT MAINTAINED] A generic and reusable SketchUp Ruby C extension file downloading utility to be used within SketchUp plugins.
C
12
star
9

Google-Sketchup-Cutlister-Plugin

[NOT MAINTAINED] A Google SketchUp plugin that allows cabinet makers to create printable cut lists for their cabinet parts.
JavaScript
12
star
10

jquery-showhide

[NOT MAINTAINED] A jQuery plugin that allows more robust show/hide functionality than the default tools.
JavaScript
11
star
11

formdata-helper

Parse FormData into a structured JavaScript object with coercion of primitive types (numbers, booleans, etc)
TypeScript
9
star
12

systemservice

A cross-platform system service manager written in Go
Go
7
star
13

qrcontact

πŸ“‡ Create a QR code with your contact details that anyone can scan to add your info to their contacts list.
Svelte
7
star
14

sentry

A super duper RFID doorlock application using Cobot, written in Node.js.
C++
5
star
15

sketchup-vistools

[NOT MAINTAINED] A collection of useful visibility tools to use within SketchUp.
Ruby
5
star
16

euphoria

MOVED TO: github.com/euphoria-css/euphoria
JavaScript
5
star
17

dotfiles

Dana's dotfiles.
Vim Script
4
star
18

learning-react

[MOVED] Various examples of using React from beginner to expert including the React-family of tools (Redux, WebPack, Babel and more)
HTML
4
star
19

tint

[NOT MAINTAINED] A not-so-sucky color picker status bar for OSX, Windows and Linux.
JavaScript
4
star
20

log

Various notes to self, learning and observations
3
star
21

easy-usb-relay

A Node.js library to control USB connected relays
JavaScript
3
star
22

typescript-base

A generic and minimalist Typescript + Prettier + Eslint starter repo
JavaScript
3
star
23

python-backupr

[NOT MAINTAINED] Backup a MySQL database easily and get optional emails sent from GMail.
Python
3
star
24

simple-sql-model

EXPERIMENTAL: A simple model wrapper around the `sql` library with helpful query and manipulation functions.
JavaScript
3
star
25

Google-SketchUp-Material-Changer

[NOT MAINTAINED] A simple Google SketchUp plugin that allows you to select any number of entities in your SketchUp model and change either the face material, back material or both. Works recursively on all sub-entities in the selection.
Ruby
3
star
26

react-examples

A series of React lessons, by example.
JavaScript
2
star
27

RDoc-Klean-Theme

A pretty RDoc theme.
2
star
28

vesl

A (conceptual) state container for React, Angular, Vue and more
2
star
29

coding-challenges

TypeScript
2
star
30

netlify-sveltekit

Svelte
2
star
31

set-state-mixin

[NOT MAINTAINED] Reflux "setState" mixin to get React-like state behavior in Reflux stores.
JavaScript
2
star
32

DataTables.RowReordering

[NOT MAINTAINED] Fork of DataTables.RowReordering
JavaScript
2
star
33

parent-folder

Get the name of the parent folder for a given path.
JavaScript
2
star
34

string-to-dom

Add a string of HTML to the DOM and return the new HTML element.
JavaScript
2
star
35

jQuery-Input-Replacement-Plugin

[NOT MAINTAINED] A simple jQuery plugin to handle the replacement of text in input fields within HTML forms.
JavaScript
2
star
36

module-skeleton

[NOT MAINTAINED] A clone-able starter skeleton for an NPM module using ES6/7 (via Babel) and a mocha/chai/sinon test suite. Checkout this repo, install dependencies and run "npm run" to see available tasks.
JavaScript
2
star
37

learn-js

A repository of various JavaScript examples with an emphasis on newer ES6/7 code.
JavaScript
1
star
38

jquery-image-viewer

[NOT MAINTAINED] A flexible jQuery image viewer/slideshow plugin that has thumbnail navigation, autoplay, and more!
1
star
39

testing-js

Examples on testing JavaScript applications using Babel, Mocha, Sinon, Chai and friends.
JavaScript
1
star
40

sveltekit-jsdom-repro

JavaScript
1
star
41

danawoodman.github.io

Dana Woodman's online portfolio.
HTML
1
star
42

gtc

A simple wrapper for the go test command that colorizes test output
Go
1
star
43

go-cli-starter

Simple, no frills Golang CLI starter template
Makefile
1
star
44

danawoodman.com

Svelte
1
star
45

replicator

[NOT MAINTAINED] Rails application generator used at Teleporter, based on thoughtbot/suspenders
Ruby
1
star
46

generator-big-starter

[NOT MAINTAINED] Starter application Yeoman generator for BIG
JavaScript
1
star
47

dropbox-ignore

Ignore files in Dropbox
Shell
1
star
48

generator-spiffy

[NOT MAINTAINED] Yeoman project generator for NPM modules (and soon, web apps)
JavaScript
1
star
49

sveltekit-router

TypeScript
1
star
50

andiekphoto.com

Portfolio of photographer Andie Kolbeck
JavaScript
1
star
51

monthly-calendar-date-helper

A simple utility that given a month and year returns an array of dates to be used in a monthly calendar. Shows previous and next months days to pad out the calendar so the calendar always starts on Sunday and lasts for 6 weeks. Option to split by week.
JavaScript
1
star