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

redicons

v1.5.0

Published

RedIcons makes it easy to use SVG Bootstrap Icons in your React projects.

Downloads

13

Readme

RedIcons

RedIcons provides you with an easy way to use Bootstrap Icons in your React projects.

I am using readmix for generating this README. You can view the source file here.

What is RedIcons

RedIcons makes using Bootstrap icons in your project as easy as this:

<RedIcon name="bs-arrow-right" />

You can also pass optional props such as size, className and fill:

<RedIcon name="bs-arrow-right" size={32} className="bg-green-500" fill="white" />

Advantages of Redicons

  1. Icons get bundled with your JavaScript. No extra network request for each icon. No need to wait for the icons to load. No need for SplashScreens.
  2. Minimal size. Only about 0.2kB per icon (1kb uncompressed). So if your project uses 50 icons, your bundle size will increase by only 10kB.
  3. Better readability (debatable, I know) than using SVGs directly or using font icons.
  4. You have more control over your icons with props such as size, fill and className. You can even use Tailwind classes.

How to use RedIcons

Installation

Install the redicons package:

npm i redicons

You can install the redicons-cli for managing redicons from your terminal:

npm i -g redicons-cli@latest

Adding icons to your project

Import icons from your redicons.json:

import rediconsJson from "./redicons.json";
const icons = rediconsJson.icons;

Here, icons is an array containing icons in JSON format.

You can generate your redicons.json with the redicons-cli or at redicons.redpapr.com.

Add icons to the red object with addIcons():

import { red } from "redicons";
red.addIcons(icons);

Using the RedIcon component

Import the RedIcon component:

import { RedIcon } from "redicons";

Using the component:

<RedIcon name="bs-bug" />

RedIcon component

The RedIcon component accepts a mandatory name prop:

<RedIcon name="bs-bug" />

If the specified icon is not found, then a default bs-question-diamond icon is displayed.

<RedIcon name="some-unknown-icon" />

This will display the default icon.

The RedIcon component accepts an optional size prop:

<RedIcon name="bs-bug" size={32} />

This will set the height and width of the icon. The default value for size is 16.

The RedIcon component accepts an optional className prop:

<RedIcon name="bs-bug" className="bg-zinc-500 text-yellow-500" />

These classes will be added to the SVG tag. You can use Tailwind classes here.

The RedIcon component accepts an optional fill prop:

<RedIcon name="bs-bug" fill="red" />

This will set the color of the icon. The default value for fill is currentColor.

The RedIcon component accepts an optional hidden prop:

<RedIcon name="bs-bug" fill="red" hidden />

This will be hidden.

Dependencies

This package has no dependencies.

Dev dependencies

| | Package | Version | | --- | ---------------------------------- | ----------- | | 1 | @rollup/plugin-commonjs | ^25.0.7 | | 2 | @rollup/plugin-json | ^6.0.1 | | 3 | @rollup/plugin-node-resolve | ^15.2.3 | | 4 | @rollup/plugin-terser | ^0.4.4 | | 5 | @rollup/plugin-typescript | ^11.1.5 | | 6 | @types/react | ^18.2.42 | | 7 | react | ^18.2.0 | | 8 | rollup | ^4.6.1 | | 9 | rollup-plugin-dts | ^6.1.0 | | 10 | rollup-plugin-peer-deps-external | ^2.2.4 | | 11 | tslib | ^2.6.2 | | 12 | typescript | ^5.3.2 |

License

MIT License

Copyright (c) Ankur Seth.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Credit

This file was generated using readmix.