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-extension-icons

v1.1.6

Published

A library for rendering file extension icons in React

Downloads

234

Readme

React Extension Icons

Description

A library for rendering file extension icons in React. This package provides SVG icons for various file extensions with three variants: color, single_color, and grayscale.

Installation

npm install react-extension-icons

Usage

Basic Usage

You can use the Icon component to render icons based on file extensions.

import React from 'react';
import { Icon } from 'react-extension-icons';

const App: React.FC = () => {
  return (
    <div>
      <Icon extension="pdf" variant="color" size={48} className="custom-class" />
      <Icon extension="docx" variant="single_color" size={48} color="blue" />
      <Icon extension="jpg" variant="grayscale" size={48} />
    </div>
  );
};

export default App;

Individual Icons

You can also use individual icon components if you prefer to import them directly.

import React from 'react';
import { PdfIconColor, DocxIconSingleColor, JpgIconGrayscale } from 'react-extension-icons';

const App: React.FC = () => {
  return (
    <div>
      <PdfIconColor width={48} height={48} className="custom-class" />
      <DocxIconSingleColor width={48} height={48} color="blue" />
      <JpgIconGrayscale width={48} height={48} />
    </div>
  );
};

export default App;

Props

Icon

| Prop | Type | Default | Description | |------------|----------------------------|-----------|------------------------------------------------| | extension | string | | The file extension to render the icon for. | | variant | 'color' \| 'single_color' \| 'grayscale' | 'color' | The variant of the icon to render. | | size | number | 24 | The size of the icon. | | className | string | '' | Additional CSS classes to apply to the icon. | | color | string | '' | The color of the icon (applies only to single_color variant). |

Individual Icon Components

All individual icon components accept the following props: | Prop | Type | Default | Description | |------------|------------|-----------|------------------------------------------------| | width | number | 24 | The width of the icon. | | height | number | 24 | The height of the icon. | | className | string | '' | Additional CSS classes to apply to the icon. | | color | string | '' | The color of the icon (applies only to single_color variant). |

Supported Extensions

This package supports the following file extensions:

| Variants | Icon | |----------|------| | ai | Icon | | avi | Icon | | bmp | Icon | | crd | Icon | | csv | Icon | | dll | Icon | | doc, docx | Icon | | dwg, dxf | Icon | | eps | Icon | | exe | Icon | | flv | Icon | | gif | Icon | | html, htm | Icon | | iso | Icon | | java, jar | Icon | | jpg, jpeg, jpe, jif, jfif, jfi | Icon | | mdb | Icon | | mid, midi | Icon | | mov, qt | Icon | | mp3 | Icon | | mp4, m4a, m4p | Icon | | mpeg, mpg, mp2, mpe, mpv | Icon | | pdf | Icon | | png | Icon | | ppt, pptx, pps, ppsx, potx, potm, ppsm, ppam, sldx, sldm | Icon | | ps | Icon | | psd | Icon | | pub | Icon | | rar | Icon | | raw | Icon | | rss | Icon | | svg | Icon | | tiff, tif | Icon | | txt | Icon | | wav | Icon | | wma, wmv | Icon | | xml | Icon | | xsl | Icon | | zip | Icon |

Credits

Icons are sourced from this Figma file created by Graphy.

License

This project is licensed under the ISC License.