bv-react-svgloader

1.2.7 • Public • Published

bv-react-svgloader

This is a ReactJS Component for SVG file loading by Ajax and DOM injection. This component allow us to insert any SVG file specifying a path and adding a class name for css customization.

Example:

Please refer to the example file to see it working.

To run the example:

  1. Clone the repository
  2. Execute in console:
cd example
yarn
mkdir node_modules/bv-react-svgloader
cd node_modules/bv-react-svgloader
ln -s ../../../svgloader.js svgloader.js
ln -s ../../../package.json package.json
cd ../../
yarn start

General Usage

As you will be able to see in example in order to use the component we need to importe it as:

import SvgLoader from 'bv-react-svgloader';

Then, in the render method we can just call it like:

<SvgLoader src='/svg/logo.svg' className="App-logo svg-logo"/>

Installation

Install this component is easy, just use npm as:

npm install bv-react-svgloader

Or using yarn:

yarn add bv-react-svgloader

Package Sidebar

Install

npm i bv-react-svgloader

Weekly Downloads

1

Version

1.2.7

License

GPL-3.0

Unpacked Size

611 kB

Total Files

23

Last publish

Collaborators

  • blasvicco