npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@react-md/icon

v5.1.6

Published

This package is for including icons within react-md. There is included support for both font icons and SVG icons. There is also a helper component for applying spacing between icons and text.

Downloads

20,672

Readme

@react-md/icon

Create icons using a font-icon library like material-icons or font-awesome or plain old accessible SVG icons. There are also a few additional helpers to creating animating rotating icons and separating text from an icon.

Installation

npm install --save @react-md/icon

It is also recommended to install the other packages if you have not done so:

npm install --save @react-md/theme @react-md/typography

Pre-made material icons

If you would like to have access to all material icons as existing components instead of having to manually remember the correct children to provide or the correct path, you can install the @react-md/material-icons package. This will include all material icons as font and SVGs.

Documentation

You should check out the full documentation for live examples and more customization information, but an example usage is shown below.

Usage

Even though the FontIcon and SVGIcon components are the "main" exports for this package, they are more utility components and probably won't be used much once you set up your own icon system. The real exports are going to be the TextIconSpacing and IconRotator components.

The TextIconSpacing component is used to add spacing between an icon and some "text" where the text can be any renderable element. The IconRotator is used to animate an icon rotation such as expander or collapse icons.

import { render } from "react-dom";
import { FontIcon, TextIconSpacing } from "@react-md/icon";
import { Typography } from "@react-md/typography";

// the Typography component is optional, it'll just add better typography
// than normal text.
const App = () => (
  <>
    // creates an icon spaced before the "Go Home" text
    <TextIconSpacing icon={<FontIcon>home</FontIcon>}>
      <Typography>Go Home</Typography>
    </TextIconSpacing>
    // creates an icon spaced after the "Go Home" text
    <TextIconSpacing icon={<FontIcon>home</FontIcon>} iconAfter>
      <Typography>Go Home</Typography>
    </TextIconSpacing>
    // it can also be combined
    <TextIconSpacing icon={<FontIcon>arrow_back</FontIcon>}>
      <TextIconSpacing icon={<FontIcon>home</FontIcon>} iconAfter>
        <Typography>Go Home</Typography>
      </TextIconSpacing>
    </TextIconSpacing>
  </>
);

render(<App />, document.getElementById("root"));

This package's icon component usage is really only helpful when generating icon components through an external script or using font icons. However, here are a few examples of using the FontIcon and SVGIcon components:

import { render } from "react-dom";
import { FontIcon, SVGIcon } from "@react-md/icon";

// When using font icons, you'll need to make sure they icon fonts have been
// correctly included in your app. Check out the documentation site for more
// info

const App = () => (
  <>
    <FontIcon>home</FontIcon>
    <FontIcon iconClassName="fa fa-github" aria-label="Github" />
    <SVGIcon title="Face">
      <path d="M9 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zm6 0c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8 0-.29.02-.58.05-.86 2.36-1.05 4.23-2.98 5.21-5.37C11.07 8.33 14.05 10 17.42 10c.78 0 1.53-.09 2.25-.26.21.71.33 1.47.33 2.26 0 4.41-3.59 8-8 8z" />
    </SVGIcon>
  </>
);

render(<App />, document.getElementById("root"));