• Design
  • Shotty
  • Blog
  • Reading
  • Photos
Menu

Jacob Ruiz

Product Designer
  • Design
  • Shotty
  • Blog
  • Reading
  • Photos
tweet.png

How to use Material Design SVG icons in React

April 4, 2019

Getting quality SVG icons into your React project is so easy with the Material Icons npm package.

1⃣ Import the icon:

import Home from '@material-ui/icons/Home’;

2⃣ Render it as a component:

<Home />

import and use.png

Because it uses the official Material icon library, there are tons of high-quality icons, and each comes in 4 versions:

Filled, Outlined, Rounded, Two tone, Sharp

icon types.png

The icon will inherit its color from the CSS "color" property of its parent container. This is a nice feature since you’re usually trying to match the icon to some text near it.

color.png

You can control many other properties of the icon with simple props. For example you can make it bigger by simply adding a prop: fontSize={large).

size.png

I’ve been using this when building high-fidelity prototypes in React. It helps speed things up so I can focus on the mechanics of the UI, rather than tediously exporting SVG from Sketch and into my React project.

no sketch.png

Try it out:

In your React project, install the package with:

👉npm install @material-ui/icons

You’ll also need to install the material core package: 

👉npm install @material-ui/core

Enjoy!

https://www.npmjs.com/package/@material-ui/icons

← Shotty Dark Mode Is Out Today!Use My Sketch File: Mac App Icon Template →
shotty-skinny2x.jpg

Shotty - Faster Access To Your Screenshots on Mac

Shotty is an award-winning Mac app I created to give you instant access to all your recent screenshots, right from the menu bar. You can even add annotations on-the-fly. Stop wasting time digging through Finder for your screenshots. I promise it’ll change your workflow forever (just read the App Store reviews!).



Most popular

information-architecture

Information Architecture: The Most Important Part of Design You're Probably Overlooking

Follow @JacobRuizDesign