Flowpoints
A developer-friendly library for creating flowcharts and diagrams.
Installation
Quick and easy installation with npm. Package site here.
Usage
To create a new diagram start by creating open-and-close tags for the "Flowspace". It’s in between these that you may add flowpoints.
No-drag areas
To create a no-drag area simply set the className of your component/element to "nodrag".
Variants
Can be defined for all flowpoints in the flowspace-props, or individually in each flowpoint's props.
Themes
Used to determine the colors used for the flowpoints. Available themes:
- red
- purple
- deep-purple
- indigo
- blue
- light-blue
- green
- light-green
- lime
- yellow
- amber
- orange
- deep-orange
- brown
- grey
- blue-grey
- black
- white
Outputs
The flowspace extracts information about all connections from the outputs of every flowpoint. Telling a flowpoint about inputs won’t have any effect.
There are two ways to pass info about the connections:
As an array.
Simply pass an array with the keys to all the flowpoints the current one should be connected to.
As an object.
Create an object using the following pattern:
The "right" and "left" arguments tell the flowspace where on the involved flowpoints the connections should attach.
Possible locations: top, left, center (default), right, bottom.
Flowpoint props
Flowspace props
Themes, variants and connectionSizes passed to the flowspace will be the default values used when drawing connections. A different value specified by a flowpoint's outputs will replace the default value for that connection only.
Suggested pattern
Once a flowpoint unmounts it will forget it's last position. To help with this (and a few more things) I find that the following pattern works really well:
Of course, you can do with much less code than this, but this example should give a good indication on how you can structure your data for a flowchart.