GithubHelp home page GithubHelp logo

alexxnica / react-icons Goto Github PK

View Code? Open in Web Editor NEW

This project forked from react-icons/react-icons

0.0 0.0 0.0 8.7 MB

:heart: svg react icons of popular icon packs

Home Page: http://gorangajic.github.io/react-icons

JavaScript 99.99% Shell 0.01%

react-icons's Introduction

React Icons

React Icons

npm

Include popular icons in your React projects easly with react-icons, which utilizes ES6 imports that allows you to include only the icons that your project is using.

Installation

npm install react-icons --save

Usage

import FaBeer from 'react-icons/lib/fa/beer';

class Question extends React.Component {
    render() {
        return <h3> Lets go for a <FaBeer />? </h3>
    }
}

If you are not using es6 compiler like babel or rollup.js, it's possible to include icons from the compiled folder ./lib. Babel by default will ignore node_modules so if you don't want to change the settings you will need to use files from ./lib

var FaBeer = require('react-icons/lib/fa/beer');

var Question = React.createClass({
    render: function() {
        return React.createElement('h3', null,
            ' Lets go for a ', React.createElement(FaBeer, null), '? '
        );
    }
});

You can include icons directly from react-icons using import FaBeer from 'react-icons', but you should wait to Webpack 2 implement dead code elimination based on es6 imports.

Also it's possible to include the whole icon pack from:

import * as FontAwesome from 'react-icons/lib/fa'

class Question extends React.Component {
    render() {
        return <h3> Lets go for a <FontAwesome.FaBeer />? </h3>
    }
}

or import multiple icons from the same pack

import {MdCancel, MdChat, MdCheck} from 'react-icons/md';

every icon pack is in their own folder

  • Material Design Icons => ./md
  • FontAwesome => ./fa
  • Typicons => ./ti
  • Github Octicons => ./go
  • Ionicons => ./io

to view all icons visit docs

Also, to view and search for the necessary icons you can use the tool Icon Viewer.

Icons

Currently supported icons are:

You can add more icons by submitting pull requests or creating issues.

Configuration

You can configure react-icons props in context.

class HigherOrderComponent extends Component {

    static childContextTypes = {
        reactIconBase: PropTypes.object
    };

    getChildContext() {
        return {
            reactIconBase: {
                color: 'tomato',
                size: 24,
                style: {
                    ...
                }
            }
        }
    }

    render() {
        ...
    }
}

Context is overriden inline.

<Icon size={30} color='aliceblue' style={{ ... }} />

Contribution

Just add svg icons in ./icons/:icons-name folder and create pull request again develop after merge I will generate React components because this process is not fully automated yet.

svg ?

Svg is supported by all major browsers.

Why es6 import and not fonts?

With react-icons, you can send icons that are specified instead of one big font file to the users, helping you to recognize which icons are used in your project.

Using create-react-app?

create-react-app tries to load the icons as files by default, rather than running through Babel. You may therefore see an erorr message similar to "You may need an appropriate loader...". The recommended workaround is to import from lib instead:

import FaBeer from 'react-icons/lib/fa/beer';

Related

Licence

MIT

  • Icons are taken from the other projects so please check each project licences accordingly.

react-icons's People

Contributors

andy-pro avatar aodinok avatar bentatum avatar christophehurpeau avatar felipeleusin avatar gorangajic avatar incleaf avatar jkomusin avatar kyleamathews avatar lotharsee avatar mergebandit avatar metasean avatar nikgraf avatar nwwells avatar steventsao avatar unseen1980 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.