1.0.6 • Published 5 years ago

react-curveto v1.0.6

Weekly downloads
7
License
MIT
Repository
github
Last release
5 years ago

NPM Build Status

React-CurveTo

Draw a curve/line between two elements in React. Fork and modify from react-lineto

Installation and usage

The easiest way to use react-curveto is to install it from npm and build it into your app with Webpack.

yarn add react-curveto

Then use it in your app:

import React from 'react';
import CurveTo from 'react-curveto';

class App extends React.Component {
render() {
    return (
            <div>
                <div className="A">Element A</div>
                <div className="B">Element B</div>
                <CurveTo
                        from="A"
                        to="B"
                        fromAnchor="top"
                        toAnchor="bottom"
                        borderColor="#000"
                        borderStyle="dotted"
                        borderWidth={2}
                        delay={0}
                        curveFrom={[50, 50]}
                        curveTo={[-100, -50]}
                    />
            </div>
        );
    }
}

Props

NameTypeDescriptionExample Values
borderColorstringBorder color#f00, red, etc.
borderStylestringBorder stylesolid, dashed, etc.
borderWidthnumberBorder width (px)
classNamestringDesired CSS className for the rendered element
delaynumber or boolForce render after delay (ms)0, 1, 100, true
fromAnchorstringAnchor for starting point (Format: "x y")top right, bottom center, left, 100% 0
from*stringCSS class name of the first element
toAnchorstringAnchor for ending point (Format: "x y")top right, bottom center, left, 100% 0
to*stringCSS class name of the second element
withinstringCSS class name of the desired container
zIndexnumberZ-index offset
curveFrom*arrayCubic control point offset, default 0,00,0, 50,-50, etc.
curveTo*arrayCubic control point offset, default 0,00,0, 50,-50, etc.

* Required

Thanks

Thank you to everyone who has contributed to this project. It's been a wild ride.

License

MIT Licensed. Copyright (c) Quang Dinh 2019.

1.0.6

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago