• Stars
    star
    492
  • Rank 89,476 (Top 2 %)
  • Language
    JavaScript
  • Created about 10 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

DEPRECATED: use https://github.com/FortAwesome/react-fontawesome instead

DEPRECATED: Use https://github.com/FortAwesome/react-fontawesome instead

Font Awesome icons as React components

Installation

React Font Awesome is distributed via npm:

npm install react react-fa

You also need to install webpack which is the only bundler at the moment capable to bundle not only JavaScript code but also stylesheets and static assets such as fonts and images:

npm install webpack

You also need a couple of loaders for webpack:

npm install babel-loader style-loader css-loader url-loader file-loader
npm install extract-text-webpack-plugin

Usage

Just as simple as:

import React from 'react'
import ReactDOM from 'react-dom'
import {Icon} from 'react-fa'

ReactDOM.renderComponent(
  <Icon spin name="spinner" />,
  document.getElementById('main')
)

Icon Component API

Props in [] are optional

Prop Type Default Description
name string undefined Required: Name of the Font Awesome Icon
[className] string undefined Set a CSS class for extra styles
[size] string undefined Increase size: 'lg', '2x', '3x', '4x', '5x'
[rotate] string undefined Rotate by deg: '45', '90', '135', '180', '225', '270', '315'
[flip] string undefined Flips Icon: 'horizontal', 'vertical'
[fixedWidth] boolean false Set Icon to a fixed width
[spin] boolean false Rotate Icon
[pulse] boolean false Rotate Icon in 8 steps
[stack] string undefined Stack Icons: '1x', '2x'. More Info
[inverse] boolean false Inverse the Icon color
[Component] string/func span Alternate DOM element

IconStack Component API

Prop Type Default Description
[children] node undefined Required: Child elements
[size] string undefined Increase size: 'lg', '2x', '3x', '4x', '5x'
[className] string undefined Set a CSS class for extra styles

Webpack Setup

Use the following webpack config (put it in webpack.config.js):

var ExtractTextPlugin = require('extract-text-webpack-plugin')

module.exports = {
  entry: './index.js',
  output: {
    path: 'assets',
    filename: 'bundle.js',
  },
  module: {
    loaders: [
      {
        test: /\.js$/,
        loader: 'babel'
      },
      {
        test: /\.css$/,
        loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
      },
      {
        test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
        loader: 'url-loader?limit=10000&mimetype=application/font-woff'
      },
      {
        test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
        loader: 'file-loader'
      }
    ]
  },
  plugins: [
    new ExtractTextPlugin('bundle.css')
  ]
}

which compile everything (js, stylesheets and icon fonts) into assets/ directory so you would need this basic HTML file to start your app:

<!doctype html>
<html>
    <head>
        <link rel="stylesheet" href="assets/bundle.css">
    </head>
    <body>
        <div id="main"></div>
        <script src="assets/bundle.js"></script>
    </body>
</html>

Note: If you run into issues with loading the FontAwesome font when not using ExtractTextPlugin, this might be fixed by making your publicPath absolute. See this StackOverflow question for details.

More Repositories

1

autobind-decorator

Decorator to automatically bind methods to class instances
JavaScript
1,451
star
2

reactify

[DEPRECATED] Browserify transform for JSX (superset of JavaScript used in React library by Facebook)
JavaScript
689
star
3

react-css-components

Define React presentational components with CSS
JavaScript
676
star
4

react-async

[DEPRECATED] Asynchronously fetch data for React components
JavaScript
446
star
5

react-quickstart

[DEPRECATED] React project template with server-side UI rendering and routing
JavaScript
370
star
6

react-time

Component for React to render relative and/or formatted dates into <time> HTML5 element
JavaScript
211
star
7

styling

Create CSS modules with the full power of JavaScript
JavaScript
130
star
8

react-derivable

React bindings for derivable state computation library
JavaScript
122
star
9

sitegen

Generate websites by composing React components
JavaScript
118
star
10

reactdown

Markdown based live document format
JavaScript
116
star
11

rrouter

Declarative routing layer for React applications
JavaScript
114
star
12

backbone.projections

backbone.projections is a set of projections for Backbone.Collection
CoffeeScript
110
star
13

validated

Validate your configurations with precise error messages
JavaScript
91
star
14

typescript-loader

[DEPRECATED] TypeScript Webpack Plugin
JavaScript
82
star
15

react-flexgrid

Flexbox Grid reimagined as a set of React components
JavaScript
73
star
16

less2stylus

[NOT MAINTAINED] LESS to Stylus source to source convertor capable of translating Bootstrap
CoffeeScript
71
star
17

xcss

xCSS is a library for programmatic stylesheet composition
JavaScript
63
star
18

backbone.viewdsl

Declarative view technology for Backbone
JavaScript
40
star
19

react-stylesheet

[DEPRECATED] A component for React to declare stylesheet dependencies for your reusable components
JavaScript
40
star
20

cssobjectify

Browserify transform to turn stylesheets into JSON objects
JavaScript
39
star
21

todomvc-flux-swarm

JavaScript
38
star
22

es6-template-strings-jsx

JavaScript
38
star
23

rethemeable

Utilities for producing and consuming themable React components
JavaScript
35
star
24

react-app-express

*DEPRECATED* React + Express + Browserify + History API + Server Side Rendering
JavaScript
32
star
25

react-app-controller

*DEPRECATED* React application controller to manage top-level React components according to window.location
JavaScript
32
star
26

type-systems

Playing with type systems
OCaml
32
star
27

routr

Request routing for WebOb based WSGI applications
Python
29
star
28

memoize-decorator

Memoize getters and methods to compute only once
JavaScript
29
star
29

sweet-assertions

Syntax for writing informative testing assertions
JavaScript
29
star
30

sweetify

Browserify transform for using Sweet.js macros
JavaScript
29
star
31

upaas

μPaaS — nano PaaS based on Docker and gitreceive
Shell
28
star
32

webpack-package-loaders-plugin

Webpack module loaders discovery through package.json
JavaScript
25
star
33

rescript

[PoC] Rescript is a scripting runtime for ReasonML
OCaml
25
star
34

julia-repl-vim

Julia REPL plugin for vim/neovim
Julia
24
star
35

react-app

*DEPRECATED* Rapid appliaction development with React
JavaScript
23
star
36

ctags-webpack-plugin

Webpack plugin to generate accurate ctags
JavaScript
21
star
37

console-ui

Composable console output (somewhat inspired by React)
JavaScript
20
star
38

purescript-node-thunk

Node callbacks as thunks
PureScript
20
star
39

rrun

[WIP] rrun allows to seamlessly run Reason/OCaml code with native speed
OCaml
19
star
40

sweet-jsx

Use JSX and sweet.js macros together
JavaScript
18
star
41

ppx_let_promise

Like async/await syntax for Promises in JS but for OCaml
OCaml
18
star
42

K.jl

K programming language dialect embedded in Julia
Julia
17
star
43

jsonpublish

Configurable JSON encoder for publishing Python objects as JSON documents
Python
17
star
44

vim-flow-outline

Outline for JS modules with Flow
Vim Script
16
star
45

BQN.jl

BQN implementation in Julia
Julia
16
star
46

rework-macro

Macro CSS transform for rework/xcss
JavaScript
16
star
47

markstruct

Block-based structured editor for Markdown
JavaScript
16
star
48

es6-module-jstransform

ES6 module syntax to CommonJS transformation
JavaScript
16
star
49

esy-docker

A set of make rules to produce docker images for esy projects
Makefile
15
star
50

configure

Configuration toolkit based on YAML
Python
15
star
51

mocha-doctest

Test your documentation
JavaScript
14
star
52

connect-browserify

Connect/express middelware for serving front-end applications with browserify.
JavaScript
13
star
53

YouTubeManager

YouTubeManager is an wrapper for YouTube JS Player API which tries to mimic SoundManager2 API.
CoffeeScript
13
star
54

domain-context

Globally accessible domain-bound contexts, connect/express middleware included
CoffeeScript
12
star
55

react-image-size-loader

Webpack loader for images which turns them into <img /> components with height and width
JavaScript
11
star
56

react-custom-events

Don't use this, this was an experiment and it doesn't work anymore with recent versions of React
JavaScript
11
star
57

babel-plugin-ast-literal

Babel Plugin AST Literal
JavaScript
11
star
58

wpack

JavaScript
10
star
59

jstransformify

Browserify transform which applies jstransform visitors
JavaScript
9
star
60

react-macros

A set of syntax extensions for React
JavaScript
8
star
61

backbone.viewevents

Events for Backbone.View which can bubble up through view hierarchy.
JavaScript
7
star
62

prefetch-context-webpack-plugin

Webpack plugin which prefetches context (all files within the directory tested by a regular expression)
JavaScript
7
star
63

musvox

Collaborative music listening environment for Minecraft-like voxel worlds
JavaScript
7
star
64

react-dom-events

**DO NOT USE THIS**
JavaScript
7
star
65

lang-julia

Julia language support for the CodeMirror code editor
TypeScript
7
star
66

dream-totp-auth

An example Dream app with password auth & totp
OCaml
6
star
67

extracty

a set of tools to extract metadata from HTML documents (WIP)
Python
6
star
68

bw_sphinxtheme

Sphinx theme in black and white colours.
JavaScript
6
star
69

inets_mod_proxy

Simple HTTP proxy module for erlang inets httpd service.
Erlang
6
star
70

sphinx-npm

Sphinx documentation tool launcher which builds docs for npm packages
JavaScript
6
star
71

purescript-immutable

PureScript bindings to Immutable.js library
PureScript
5
star
72

swarm-react

JavaScript
5
star
73

asyncomplete-ale.vim

LSP completion source (via ALE) for asyncomplete.vim
Vim Script
5
star
74

esy-bsb-example

OCaml
5
star
75

stream-rpc

RPC over arbitrary streams for Node.js and a browser
CoffeeScript
5
star
76

deps-topo-sort

Sort module-deps/dgraph output topologically
JavaScript
5
star
77

diffbot

DiffBot API wrapper (uses urllib3)
Python
5
star
78

webpack-stylegen

JavaScript
5
star
79

react-router-component-bower

Bower package for react-router-component
JavaScript
5
star
80

fzf-merlin

Vim Script
5
star
81

aoc2021

AOC2021 in BQN
5
star
82

contentlet

Framework for creating composable and reusable web UI.
Python
5
star
83

require-assets

A library to package and re-use static assets
JavaScript
5
star
84

dgraph

Build and transform dependency graphs from JS, CSS or other code bases
JavaScript
4
star
85

sphinxalchemy

SphinxQL dialect for SQLAlchemy (uses MySQLdb-Python for wire protocol)
Python
4
star
86

es6-destructuring-jstransform

ES6 destructuring assignment and destructuring function arguments transformation.
JavaScript
4
star
87

reason-react-workshop

CSS
4
star
88

faviconr

Fast and robust favicon resolution
CoffeeScript
4
star
89

esy-solve-cudf

Makefile
4
star
90

jsxx

JSX eXperimental
JavaScript
4
star
91

wall

Extremely hackable HN/Reddit clone in PostgreSQL + Node + Express + React
CoffeeScript
4
star
92

backbone.module

Spine.Module but for Backbone
CoffeeScript
4
star
93

esy-reason-graphql-server

[EXAMPLE REPO, NOT MAINTAINED] Reason + GraphQL on esy
OCaml
4
star
94

pureact

PureScript
3
star
95

ppx_router

type safe routing for Dream
OCaml
3
star
96

docgen.mk

a set of utilities and make macros for static site generation
Python
3
star
97

fb.py

Python bindings for Facebook Graph API
Python
3
star
98

react-pad

Authoring tool for React components
JavaScript
3
star
99

ocamlstripdebug

An utility to strip debug info from OCaml bytecode.
OCaml
3
star
100

react-async-middleware

Connect/express middleware to serve react-async components
JavaScript
3
star