Socket
Socket
Sign inDemoInstall

react-svg-injector

Package Overview
Dependencies
1
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-svg-injector

A React component that manipulate SVG and injects it using SVGInjector


Version published
Weekly downloads
19
increased by18.75%
Maintainers
1
Install size
120 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 08 Jun 2018

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc