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-svgbox

v1.0.0

Published

Simple React components for using the svgbox.net API.

Downloads

6

Readme

react-svgbox

Simple React components for using the svgbox.net API.

npm Travis (.com)

Documentation

Table of Contents

Installation

yarn add react-svgbox

Basic Usage

import React, { Component } from 'react'

import Icon from 'react-svgbox'

class Example extends Component {
  render() {
    return (
      <Icon
        className='example'
        fillColor='000000'
        iconSet='loaders'
        icon='three-dots'
      />
    )
  }
}

Components

Icon (default)

The Icon component is the "catch all" component for the main icon sets.

Usage

import React, { Component } from 'react'

import Icon from 'react-svgbox'

class Example extends Component {
  render() {
    return (
      <Icon
        className='example'
        fillColor='000000'
        iconSet='loaders'
        icon='three-dots'
      />
    )
  }
}

Props

| Prop | Description | | --------- | -------------------------------------------------------------------------------------------------------------- | | className | Any additional classes you want to add. | | iconSet | The icon set you want to use. Options are social, materialui, hero-solid, hero-outline, and loaders. | | icon | The name of the icon you want to render. | | fillColor | The color you want the icon to be. Fill color can be in multiple formats. |

Social

The Social component can be used to render icons from the Social, Web, and Apps icon set.

Usage

import React, { Component } from 'react'

import { Social } from 'react-svgbox'

class Example extends Component {
  render() {
    return <Social className='example' fillColor='000000' icon='airbnb' />
  }
}

Props

| Prop | Description | | --------- | --------------------------------------------------------------------------------------------------- | | className | Any additional classes you want to add. | | icon | The name of the icon you want to render. | | fillColor | The color you want the icon to be. Fill color can be in multiple formats. |

MaterialUi

The MaterialUi component can be used to render icons from the Material UI icon set.

Usage

import React, { Component } from 'react'

import { MaterialUi } from 'react-svgbox'

class Example extends Component {
  render() {
    return <MaterialUi className='example' fillColor='000000' icon='bolt' />
  }
}

Props

| Prop | Description | | --------- | --------------------------------------------------------------------------------------------------- | | className | Any additional classes you want to add. | | icon | The name of the icon you want to render. | | fillColor | The color you want the icon to be. Fill color can be in multiple formats. |

Heroicons (Outline)

The HeroOutline component can be used to render icons from the Heroicons (Outline) icon set.

Usage

import React, { Component } from 'react'

import { HeroOutline } from 'react-svgbox'

class Example extends Component {
  render() {
    return <HeroOutline className='example' fillColor='000000' icon='archive' />
  }
}

Props

| Prop | Description | | --------- | --------------------------------------------------------------------------------------------------- | | className | Any additional classes you want to add. | | icon | The name of the icon you want to render. | | fillColor | The color you want the icon to be. Fill color can be in multiple formats. |

Heroicons (Solid)

The HeroSolid component can be used to render icons from the Heroicons (Solid) icon set.

Usage

import React, { Component } from 'react'

import { HeroSolid } from 'react-svgbox'

class Example extends Component {
  render() {
    return <HeroSolid className='example' fillColor='000000' icon='user-add' />
  }
}

Props

| Prop | Description | | --------- | --------------------------------------------------------------------------------------------------- | | className | Any additional classes you want to add. | | icon | The name of the icon you want to render. | | fillColor | The color you want the icon to be. Fill color can be in multiple formats. |

Loading Animations

The Loader component can be used to render icons from the Loading Animations icon set.

Usage

import React, { Component } from 'react'

import { Loader } from 'react-svgbox'

class Example extends Component {
  render() {
    return <Loader className='example' fillColor='000000' icon='three-dots' />
  }
}

Props

| Prop | Description | | --------- | --------------------------------------------------------------------------------------------------- | | className | Any additional classes you want to add. | | icon | The name of the icon you want to render. | | fillColor | The color you want the icon to be. Fill color can be in multiple formats. |

Flags

The Flag component can be used to render icons from the Flags (Low Def) and Flags (High Def) icon sets.

Usage

Low Def Flag
import React, { Component } from 'react'

import { Flag } from 'react-svgbox'

class Example extends Component {
  render() {
    return <Flag flag='us' quality='low' />
  }
}
High Def Flag
import React, { Component } from 'react'

import { Flag } from 'react-svgbox'

class Example extends Component {
  render() {
    return <Flag flag='us' quality='high' />
  }
}

Props

| Prop | Description | | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | flag | The flag icon you want to render. | | quality | The quality of the flag icon you want to render. Value can be low for low def or high for high def. If no quality is provided, high will be used. |

Pattern Backgrounds

The Pattern component can be used to render background patterns from the Pattern Backgrounds icon set.

Usage

import React, { Component } from 'react'

import { Pattern } from 'react-svgbox'

class Example extends Component {
  render() {
    return (
      <Pattern
        className='example-class'
        pattern='4-point-stars'
        fillColor='purple-600'
        bgColor='#fff'
        bgSize='32px'
      >
        <h1>Hello World</h1>
      </Pattern>
    )
  }
}

Props

| Prop | Description | | --------- | --------------------------------------------------------------------------------------------------------- | | className | Any additional classes you want to add. | | pattern | The name of the pattern you want to render. | | fillColor | The color you want the icon to be. Fill color can be in multiple formats. | | bgColor | The background color of the wrapping div that is rendered. The value can be any valid CSS color format. | | bgSize | The size of the pattern icon used to create the pattern background. |

Specifying Fill Color

Most components accept a fillColor prop for specifying the fill color of the icon/pattern. This prop supports multiple formats:

  • Hex Format: f50a0a
  • RGB Format: rgb(41,152,0)
  • HSL Format: hsl(14,100%,30%)
  • Tailwind Colors: purple-600
  • HTML5 Common Colors: violet

License

MIT © GeoffSelby