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

@sammarks/icons

v1.15.0

Published

My personal componetized SVG Icons for React

Downloads

85

Readme

SVG Icons

This is a template repository used to quickly scaffold a React SVG Icon library.

Installation

This repository isn't published. It exists as a template repository for you to use, populate with SVGs, and maintain an Icon library!

If you use this template repository, please ensure that the .browserslistrc and svgo.config.js match defaults that make you and/or your company happy. Additionally, you'll want to change the import path defining ProductionBundleIconsMap in both src/index.test.js and src/index.stories.tsx to match the name field of your package.json.

Native

This library supports React Native. Just import icons using @sammarks/icons/native instead of @sammarks/icons.

Internally, it uses react-native-svg, so make sure that's installed and configured as well.

Contributing new icons to the library

Process

  • Put your SVG icon into src/svgs (or src/svgs/color for color SVGs)
  • Ensure that the svg includes a title element as the first child of the svg element.
    • Its content should be a human-readible description of the SVG (this is for accessibility)
  • Add the correct type-safe mapping in src/index.ts (follow the pattern)
  • Add the correct type-safe mapping in src/native.tsx (follow the pattern)
  • yarn format:all to format the SVGs.
  • yarn build && yarn test -u to updates snapshots
  • yarn storybook to go and see the result of your work in Storybook.

Usage

Importing

import { Alert, Basketball } from 'svg-icons';

Customizing

Every component accepts all props that you'd expect an inlined svg to accept in a React environment. This includes className, style, fill, width, height, etc.

import { Alert } from 'svg-icons';

<Alert fill="#FFF" width="20px" height="20px" />

Considerations when deciding if your icon belongs here

  1. If you want the icon to express meaning by itself (without text)...

Please render the SVG inline into your application. Be sure that aria-hidden="false" and also apply an id to the <title> aspect of the SVG. Lastly, give the value of that id to the attribute aria-labelledby on the actual <svg>.


  1. If you don't want the icon to be customizable (fill, stroke, etc.) via props...
  2. If you want the paths of the icon to be controllable in animations...

This repository is for uniformly behaving, customizable icon sets. Please render the SVG inline into your application OR please integrate react-svg-loader into your application, steal our svgo config, and simply manage the implementation yourself.


  1. If you want the paths of the icon to be customizeable...

You'll want to make a custom component in your application. Please render the SVG inline into your application OR please integrate react-svg-loader into your application, steal our svgo config, and simply manage the implementation yourself.


  1. If the icon has a predefined fill attribute on the actual <svg>...

Note that fill is transformed to be currentColor. All you'll need to do is ensure the icon is rendered in a parent element whose CSS property color is defined.