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

v0.7.0

Published

<p align="center"> <a href="https://github.com/MohamedTahaAmer/react-files-icons"> <img src="https://utfs.io/f/b9b8de02-2d81-431a-8b09-199f3f24e224-8ndh56.svg" alt="React-Files-Icons" width="200"> </a> <a href="https://github.com/MohamedTahaAmer

Downloads

28

Readme

react-files-icons is a collection of file and folder icons for React applications. This package provides 1200 SVG icons for files and folders.

You can pass file or folder name and react file icons will infer the appropriate Icon to display.

All the Icons are JSX components that accepts all props that can be passed to a JSX Element, allowing for easy styling and total control over the appearance of the icons.

Design Decisions

  • Local SVGs: Instead of fetching icons on the fly, all icons are included locally and converted to JSX components. This reduces the number of requests, resulting in faster performance.

  • JSX Components: By converting the SVG icons to JSX components, users can easily customize the style of the icons using React props. This provides more flexibility in terms of scaling, coloring, and applying additional styles.

Installation

npm install react-files-icons
bun install react-files-icons
pnpm install react-files-icons
yarn add react-files-icons

Example usage

Sample App: react-files-icons-preview

1. Displaying Icons by their direct name.

// - Only these Icons will be shipped in the client bundle.

import { FileTypeCss, FolderTypeSrc, FolderTypeSrcOpened } from "react-files-icons/icons"

function Icons() {
  return (
    <>
      <FileTypeCss className="size-24" aria-label="Css Icon" />
      <FolderTypeSrc className="size-24" aria-label="Folder Icon" />
      <FolderTypeSrcOpened className="size-24" aria-label="Open Folder Icon" />
    </>
  )
}
export default Icons

2. Inferring the Icon name based on the file or folder name.

// - The Icon name will be inferred from the name prop.
// - All Icons will be shipped in the client bundle.

import { FileIcon, FolderIcon, OpenFolderIcon } from "react-files-icons"

function DynamicIcons({ name }) {
  return (
    <>
      <FileIcon name="index.css" />
      <FolderIcon name="src" />
      <OpenFolderIcon name="src" />
    </>
  )
}
export default DynamicIcons

3. Lazy Loading Icons

// - The Icon name will be inferred from the name prop.
// - Icons are fetched from the server after the initial render and a placeholder will be displayed meanwhile.

import { SuspendedFileIcon, SuspendedFolderIcon, SuspendedOpenFolderIcon } from "react-files-icons/suspended"

function DynamicIcons({ name }) {
  return (
    <>
      <SuspendedFileIcon name="index.css" />
      <SuspendedFolderIcon name="src" />
      <SuspendedOpenFolderIcon name="src" />
    </>
  )
}
export default DynamicIcons

Acknowledgements

This package was inspired by vscode-icons-js, which provided a comprehensive set of file and folder icons. I have adapted the logic from this package to infer the appropriate icon based on the file name, while re-imagining how the icons are delivered and used in a React context.