Giter Club home page Giter Club logo

react-easy-diagram's Introduction

React Easy Diagram logo

⚠️ This package will not be supported anymore. I recommend using https://reactflow.dev instead.

I started developing this package almost 3 years ago because of very poor developer experience with other existing packages at that moment. Since I invested my spare time only on features I personally needed, the development wasn't very fast, and so, during this period another package arrived, that has so many features, that it would be a waste of time to try to implement all of them again. That is why I decided to stop developing React Easy Diagrams and switch to React Flow for my personal projects.


Open source library to build highly customizable interactive React diagrams with easy. React Easy Diagram demo image

Features

  • Customization - The library was designed from the ground up to be easily customizable so you can change any component you like or customize existing ones.
  • HTML nodes - Nodes are represented as HTML, so you can define them at any level of complexity. (Because of this, if expected nodes number exceeds hundreds of them then it is better to use libraries with other approaches, for example diagrams that use Canvas)
  • Advanced API - Entire diagram state with all its methods and types are available so you are aware about everything that is going on in library and can manipulate the state as you want.
  • Performance - Thanks to MobX all components are rerendered only when it strictly needed.
  • Touch devices support - User interaction is implemented with helps of UseGesture library that enables you to use diagrams not only on PC but also on touch devices, use pinch & zoom gesture.

Roadmap

There are several top priority things right now:

  • Add link's label.
  • Add callbacks for better control over the library.
  • Test code as much as possible.
  • Prepare repository for contribution by other developers (issues templates, commit messages template, discussion section).

Installation

Using npm:

npm install react-easy-diagram

Using yarn:

yarn add react-easy-diagram

Getting started

There are three main entities in library: node, port, link.

Entities

To create diagram import Diagram:

import { Diagram } from "react-easy-diagram";

Pass it to the rendering function and provide state and settings as a props, for example:

const YourDiagram = () => (
    <Diagram initState={{
        nodes: [
          {
            id: "node_1",
            position: [300, 300],
            type: "output_horizontal" // there are other built-in types, such as input_output_horizontal, input_output_vertical, input_vertical, input_horizontal, output_vertical, star. You can also provide your own types in settings.
          },
          {
            id: "node_2",
            position: [520, 400],
            type: "input_horizontal" 
          },
        ],
        links: [
          {
            source: {
              nodeId: "node_1",
              portId: "output"
            },
            target: {
              nodeId: "node_2",
              portId: "input"
            }
          },
        ]
      }} />
);

react-easy-diagram's People

Contributors

tokarchyn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

react-easy-diagram's Issues

Add labels for links.

In addition to just add simple labels as a text, consider also how they can be customized, if it would be possible to add multiple labels and so on.

Problem with zoomToFit

I have text type nodes with editable content. When I use the function zoomToFit, the calculation of the box containing the elements seems incorrect.
How can I control this problem?
Capture d’écran 2022-05-11 à 18 47 39

Add changelog file

It should also be autogenerated from commits message and integrated into CI.

Fix hidden links on mobile

When pan the map to the left-up links dissappear. Probably problem is caused by css overflow property.

Set the initstate with extra props

Hi,
Is it possible to init the initstate with extra saved ? The node uses id or label for the content but not extra.
I used it for saving image, html content…
5A621FD0-D430-40A0-BD67-B3547087D095

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.