🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

react-svg-connector

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-svg-connector

React component to draw svg connectors between any React components

1.0.1
Source
npm
Version published
Weekly downloads
6.6K
457.52%
Maintainers
1
Weekly downloads
 
Created
Source

react-svg-connector

React component to draw svg connectors to connect any React components

Installation

npm install react-svg-connector

or

yarn add react-svg-connector

Usage

Component props:

  • el1: first React component
  • el2: second React component
  • shape (optional): 's' | 'narrow-s' | 'line'
  • direction (optional): 'r2l' | 'l2l' | 'r2r' | 'l2r'

Please run a full example to see all available props.

S shape

narrow-s shape


const Box = styled.div`
  width: 150px;
  height: 50px;
  cursor: pointer;
`;

const Box1 = styled(Box)`
  background-color: green;
`;

const Box2 = styled(Box)`
  background-color: red;
`;

function App() {
  const ref1 = useRef();
  const ref2 = useRef();

  return (
    <Wrapper>
      <Connector
        el1={ref1.current}
        el2={ref2.current}
        shape="narrow-s"
        direction="r2l" // "l2l", "r2r", "l2l"
      />
        <Box1 ref={ref1} />
        <Box2 ref={ref2} />
    </Wrapper>
  );
}

Keywords

React

FAQs

Package last updated on 22 Feb 2021

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