2.0.2 • Published 6 years ago

react-svg-injector v2.0.2

Weekly downloads
21
License
MIT
Repository
github
Last release
6 years ago

ReactSvgInjector

Greenkeeper badge

Example

import React from "react";
import { ReactSvgInjector, Mutate } from "react-svg-injector";
import logo from "./logo.svg";

const Logo = props => (
  <ReactSvgInjector src={logo} className="App-logo">
    <Mutate selector="g" fill="#BADA55" />
  </ReactSvgInjector>
);

export default Logo;

API

ReactSvgInjector exports 2 React Components ReactSvgInjector and Mutate.

ReactSvgInjector

props

nametypedescription
callback(svg)functioncallback which passes the svg element once it's been loaded
evalScriptsstringoption to tell ReactSvgInjector to eval scripts inside the svg element options are: always, once, never default: once
*anyall other props that are passed will be merged into the svg element

Mutate

props

nametypedescription
selectorstringthe selector of the node to modify
*anyall other props that are passed will be merged into the element that matches the selector
2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago