svg2component

2.0.1 • Public • Published

svg2component

Converts SVG icons into React components.

Example

icon.svg:

<svg xmlns="http://www.w3.org/2000/svg">
    <circle stroke-width="2" fill="#191919" stroke="#424242"></circle>
</svg>
$ svg2component icon.svg > icon.js

icon.js:

import React from 'react';
 
const Icon = ({size, color='#191919', strokeColor='#424242'}) => (
    <svg width={size} height={size}>
        <circle strokeWidth="2" fill={color} stroke={strokeColor}></circle>
    </svg>;
);
 

Readme

Keywords

none

Package Sidebar

Install

npm i svg2component

Weekly Downloads

3

Version

2.0.1

License

MIT

Last publish

Collaborators

  • atabel