New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-show-svg

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-show-svg

React wrapper component for svg icons

latest
Source
npmnpm
Version
0.10.3
Version published
Maintainers
1
Created
Source

React show svg

Build Status

Simple react component that transforms plain svg to usable icon.

TL;DR

import React from 'react';
import ReactShowSvg from 'react-show-svg';
import SvgIcon from 'path/to/icon.svg';

class App extends React.Component {
  render() {
    return (
      <ReactShowSvg
        size="30px"
        fill="#000000"
        icon={SvgIcon}
      />
    );
  }
}

NPM

$ npm install react-show-svg --save

Yarn

$ yarn add react-show-svg

Usage

Import raw svg file with svg-inline-loader and pass it as icon property.

You can also pass width & height or size properties ( pass size if you want width & height to be equal ).

IMPORTANT - Update your webpack config file:

const config = {
  module: {
    rules: [
      {
        test: /\.svg$/,
        use: [
          {
            loader: 'svg-inline-loader'
          }
        ]
      }
    ]
  }
}

API

  • icon: string
  • width: string
  • height: string
  • size: string ( width & height )
  • fill: string
  • className: string
  • onClick: function
  • ref: function
  • id: string

Dependencies

FAQs

Package last updated on 23 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts