Giter Club home page Giter Club logo

react-icons-material-design's Introduction

react-icons-material-design

npm version npm downloads

A library of React components for Material Design Icons created by Google. This library is a fork of tabler-icons-react with some modifications. Special thanks to @konradkalemba for his work.

Features

  • Zero dependencies.
  • TypeScript friendly.
  • 3000+ icons with variants: Filled, Outlined, Round, Sharp, TwoTone. You can explore and choose your icons at Material Design Icons.
  • SVGs optimized with SVGO.
  • Easy to import using named exports.
  • Tree-shakeable verified by agadoo.

Installation

The package is available via npm and can be installed using npm or yarn:

# npm
npm install react-icons-material-design

# yarn
yarn add react-icons-material-design

Usage

After installing the package, you can import React Material Icons as React components:

import {
  IconLocationCityFilled,
  IconLocationCityOutlined,
  IconLocationCityRound,
  IconLocationCitySharp,
  IconLocationCityTwoTone,
} from 'react-icons-material-design';

Examples

  1. Basic usage:
import React from 'react';
import { IconLocationCityFilled } from 'react-icons-material-design';

export default function Example() {
  return (
    <div>
      <IconLocationCityFilled color='red' size={24} />
    </div>
  );
}
  1. Usage with a custom component:
import React from 'react';
import { IconLocationCityFilled } from 'react-icons-material-design';

export default function Example() {
  return (
    <div>
      <YourIconComponent icon={IconLocationCityFilled} />
      <YourIconComponent icon={<IconLocationCityFilled />} />
      <YourIconComponent icon={<IconLocationCityFilled size={24} color='red' />} />
    </div>
  );
}

Styling

You can pass additional props to adjust the icon.

name type default
size Number,String '1em'
color String currentColor
import React from 'react';
import { IconLocationCityFilled } from 'react-icons-material-design';

export default function Example() {
  return (
    <div>
      <IconLocationCityFilled color='red' size={24} />
    </div>
  );
}

We can also style using CSS:

  • Icons are already set with width="1em" height="1em" allowing you to change the size via font-size.
  • Icons are already set with fill=currentColor allowing you to change the color via color.

CSS

import React from 'react';
import { IconLocationCityFilled } from 'react-icons-material-design';

export default function Example() {
  return (
    <div>
      <IconLocationCityFilled style={{ fontSize: '2em', color: 'green' }} />
    </div>
  );
}

TailwindCSS

import React from 'react';
import { IconLocationCityFilled } from 'react-icons-material-design';

export default function Example() {
  return (
    <div>
      <IconLocationCityFilled className="text-3xl text-green-700" />
    </div>
  );
}

License

This project is licensed under the MIT License.

react-icons-material-design's People

Contributors

huongdevvn avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 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.