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

@stellaestudio/r2icon

v1.0.2

Published

Ready2Order Design System - Foundation icons library

Downloads

6

Readme

@stellaestudio/r2icon

Ready2order Design System - Foundation icons library

Install package

After installing npm or yarn, you can install @stellaestudio/r2icon with this command:

# with npm
npm i -S @stellaestudio/r2icon

# with yarn
yarn add @stellaestudio/r2icon

Or you can also install it with a CDN like unpkg.com. You can browse content here.

Usage

Once you have installed this package, depending on your setup, you can include @stellaestudio/r2icon in a handful of ways.

  • Reference via <img> element
  • Use the SVG sprite
  • Use the icon font
  • Include via CSS
  • Copy-paste SVGs as embedded HTML

Foundation icons gives you SVGs, so you can include them into your HTML in a few ways depending on how your project is setup. Our icons include a width and height of 16px by default to allow for easy resizing via font-size.

External image

Reference Icons SVGs like normal images with the <img> element.

<img
  src="/node_modules/@stellaestudio/r2icon/dist/r2icon/svg/home-fill.svg"
  alt="Home icon filled"
  width="32"
  height="32"
/>

Sprite

Use the SVG sprite to insert any icon through the <use> element. Use the icon’s filename as the fragment identifier (e.g., home-fill is #home-fill). SVG sprites allow you to reference an external file similar to an <img> element.

<svg width="32" height="32" fill="#001018">
  <use
    xlink:href="/node_modules/@stellaestudio/r2icon/dist/r2icon/sprite/r2icon.svg#home-fill"
  />
</svg>

Icon font

Icon fonts with classes for every icon are also included. Include the icon web fonts in your page via CSS (./node_modules/@stellaestudio/r2icon/dist/r2icon/font/r2icon.css), then reference the class names as needed (e.g. r2icon-home-fill for the home-fill icon) in your HTML.

Use font-size and color to change the icon appearance.

If your icon is followed by a text:

<span aria-hidden="true" class="r2icon-home-fill"> </span> Homepage

If your icon is alone:

<span aria-label="Homepage" class="r2icon-home-fill"> </span>

CSS

You can also use the SVG within your CSS (be sure to escape any characters, such as # to %23 when specifying hex color values). When no dimensions are specified via width and height on the <svg>, the icon will fill the available space.

The viewBox attribute is required if you wish to resize icons with background-size. Note that the xmlns attribute is required.

.your-class {
  content: '';
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.333 7.333v-4h1.334v4h4v1.334h-4v4H7.333v-4h-4V7.333h4Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 1rem 1rem;
}

Embedded

Embed your icons within the HTML of your page (as opposed to an external image file, not really recommended). Here we’ve used a custom width and height alongside viewbox.

<svg
  width="16"
  height="16"
  fill="#001018"
  viewBox="0 0 16 16"
  xmlns="http://www.w3.org/2000/svg"
>
  <path
    d="M7.333 7.333v-4h1.334v4h4v1.334h-4v4H7.333v-4h-4V7.333h4z"
    fill="#001018"
  />
</svg>