Code Monkey home page Code Monkey logo

mui-icons's Introduction

Mui Icons

npm

Effortlessly include icons from the most popular icon libraries in you Material-UI project. This project wraps each icon with Mui's SvgIcon component so they are compatible with Material UI and will match your theme.

Installation

Yes, you guessed it:

npm i -S mui-icons

This package has material-ui as a peer dependency, so remember to also have that in your node_modules.

npm i -S material-ui

Usage

Simply import the icons you want and add them to IconButtons or anywhere else.

import React from 'react';
import IconButton from 'material-ui/IconButton';

import Heart from 'mui-icons/cmdi/heart';
// import Heart from 'mui-icons/evilicons/heart';
// import Heart from 'mui-icons/fontawesome/heart';
// import Heart from 'mui-icons/ionicons/ios-heart';
// import Heart from 'mui-icons/mdi/favorite';
// import Heart from 'mui-icons/octicons/heart';
// import Heart from 'mui-icons/typicons/heart';

const LoveButton = () => (
  <IconButton>
    <Heart />
  </IconButton>
);

export default LoveButton;

If you know what you are doing you may also include all of the icons from a library:

// Prefer this
import Ionicons from 'mui-icons/ionicons';
// This works too, but don't use it
import { Ionicons } from 'mui-icons';

The first option is preferable, because the second, if a tree-shake is not implemented it would result in a bundle larger than necessary (unless you really are using every single icon from the package).

Libraries Included

Name Folder Name Home Page Number if Icons
Community Material Design Icons cmdi https://materialdesignicons.com/ 1956
Evil Icons evilicons http://evil-icons.io/ 70
FontAwesome fontawesome http://fontawesome.io/ 694
Ionicons ionicons http://ionicons.com/ 859
Material Design Icons mdi https://material.io/icons/ 959
Github Octicons octicons https://octicons.github.com/ 176
Typicons typicons http://www.typicons.com/ 336

Configuration

Any props added to an Icon will be forwarded to Mui's SvgIcon element (except for children, which will be the paths of the icon you want). Check the Mui docs to see it's props.

Known Issues

  • Ionicons uses style on some icons, which react doesn't seem to like.
  • svgscaler breaks IonIcons and EvilIcons. Using style to reset scale and position.

Final Notes

This package is based on the excelent react-icons package.

Licence

MIT

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

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.