0.1.17 • Published 2 years ago

solid-graph v0.1.17

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Convert Your Ideas To Graphs With Solid Graph!

Solid Graph

A lightweight and minimal Solid component for building interactive graphs and node-based editors.

Key Features

  • Easy to use: Just provide the nodes and edges data and it automatically gets converted to an interactive graph with seamless zooming and panning.
  • Customizable: Different edge types and support for custom nodes and custom edges.
  • Fast rendering: Only nodes that have changed are re-rendered and only those in the viewport are displayed
  • Reliable: Written in Typescript.

Installation

The easiest way to get the latest version of Solid Graph is to install it via npm:

npm install solid-graph # or yarn add

Quick Start

import SolidGraph from "solid-graph";

function Flow(props) {
  return <SolidGraph nodes={props.nodes} edges={props.edges}></SolidGraph>;
}

SolidGraph Props

NameTypedefaultDescription
nodesNode[][]array of nodes
edgesEdge[][]array of edges
widthnumber800width of the container
heightnumber800height of the container
type Node = {
  id: number,
  position: { x: number, y: number },
  data: { label: string, ... },
  width?: number,
  height?: number,
  bgColor?: string,
  fontSize?: number,
  borderColor?: string,
  borderRadius?: number,
  textColor?: string,
};

type Edge = {
  source: number,
  target: number,
  label?: string,
  type?: "straight" | "smoothStep" | "step",
  animated?: boolean,
  noHandle?: boolean,
  arrow?: boolean,
  style?: JSX.CSSProperties,
  labelStyle?: JSX.CSSProperties,
  labelBgStyle?: JSX.CSSProperties,
};

Development

Before you start you need to build the project using npm run build. Then install the Solid Graph dependencies via npm install.

If you want to contribute or develop custom features the easiest way is to start the dev server:

npm start

Credits

Solid Graph is heavily based on react flow. Without them Solid Graph would not exist. Please consider donating to them.

License

Solid Graph is MIT licensed.

0.1.17

2 years ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago