Socket
Book a DemoInstallSign in
Socket

react-svg-injector

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

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

2.0.2
latest
Source
npmnpm
Version published
Weekly downloads
67
11.67%
Maintainers
1
Weekly downloads
 
Created
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

react

FAQs

Package last updated on 08 Jun 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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.