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

@zendeskgarden/svg-icons

v7.1.0

Published

Garden SVG icons

Downloads

24,632

Readme

Garden SVG Icons npm version Build Status Dependency Status

:seedling: Garden is the design system by Zendesk

This repo packages a collection of SVG icons used throughout Zendesk products. All source icons are optimized for size + readability.

Installation

npm install @zendeskgarden/svg-icons

The package contains a src folder with individual SVG icons along with a combined "spritemap" dist of SVG symbols.

Usage

Garden SVGs come in two flavors – monochrome and two-tone. The primary fill/stroke will always be specified as currentColor. This means CSS text color style will cascade to the icon. Two-tone icons can receive a secondary color via the fill style property. In the following example, the top arrow of the "sort" icon will be blue; the bottom arrow will be red (see spritemap below for more re: SVG use with an external source).

<svg style="color: blue; fill: red;">
  <use xlink:href="index.svg#zd-svg-icon-12-sort-fill">
</svg>

Once installed, SVG icons may be accessed in a variety of ways. The following list demonstrates several possibilities, however usage will vary depending on the particular needs of your application.

  • JavaScript

    In the following snippet, a source SVG is loaded just like any other JS module. SVGs loaded in this manner will benefit from the same caching as any other JS asset.

    import ZendeskIcon from '@zendeskgarden/svg-icons/src/26/zendesk.svg';
    
    class ZendeskButton extends React.Component {
      render() {
        return (
          <button>
            <ZendeskIcon />
          </button>
        );
      }
    }
  • PostCSS

    Several Garden CSS Components utilize the postcss-inline-svg plugin to compile SVGs into CSS.

    1. Configure the plugin:
    "postcss-inline-svg": {
      "path": "node_modules/@zendeskgarden/svg-icons/src"
    }
    1. Load an SVG in your source CSS:
    .icon {
      background-image: svg-load('16/remove.svg', color: #007fab);
    }
    1. Build via postcss to inline the SVG into your destination CSS as a data URI:
    .icon {
      background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' color='%23007FAB' ...");
    }
  • Spritemap

    The main distribution from the npm package is an SVG "spritemap" containing all source icons as <symbol> elements. Once that file is hosted, any icon may be externally referenced using its unique ID.

    <svg>
      <use xlink:href="/path/to/index.svg#zd-svg-icon-16-chevron-down-stroke">
    </svg>

    By referencing the external resource, you take advantage of the browser cache. Subsequent <use xlink:href> will leverage the cached SVG spritemap. Note you'll need to use a polyfill like svg4everybody to compensate for browsers (IE9-11) that can't handle external SVG content.

  • Build pipeline

    There are numerous plugins for handling SVG files via an asset bundler (webpack, gulp, grunt, etc.). Search npm and select one that fits your needs.

Contribution

Thanks for your interest in Garden! Community involvement helps make our design system fresh and tasty for everyone.

Got issues with what you find here? Please feel free to create an issue.

If you'd like to take a crack at making some changes, please follow our contributing documentation for details needed to submit a PR.

Community behavior is benevolently ruled by a code of conduct. Please participate accordingly.

License

Copyright 2021 Zendesk

Licensed under the Apache License, Version 2.0