{"id":15831772,"url":"https://github.com/briuor/rflowz","last_synced_at":"2026-05-01T13:33:12.231Z","repository":{"id":65045510,"uuid":"527694084","full_name":"Briuor/rflowz","owner":"Briuor","description":"React library for building flowcharts and diagrams","archived":false,"fork":false,"pushed_at":"2022-12-22T19:14:22.000Z","size":1218,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-12T12:44:51.153Z","etag":null,"topics":["diagram","fllow","flow","flowchart","graph","react","react-diagrams","react-flow","react-library","typescript","workflow"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Briuor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-22T18:52:37.000Z","updated_at":"2023-12-24T07:31:47.000Z","dependencies_parsed_at":"2022-12-26T20:10:45.847Z","dependency_job_id":null,"html_url":"https://github.com/Briuor/rflowz","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Briuor%2Frflowz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Briuor%2Frflowz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Briuor%2Frflowz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Briuor%2Frflowz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Briuor","download_url":"https://codeload.github.com/Briuor/rflowz/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246635886,"owners_count":20809329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["diagram","fllow","flow","flowchart","graph","react","react-diagrams","react-flow","react-library","typescript","workflow"],"created_at":"2024-10-05T12:21:48.066Z","updated_at":"2026-05-01T13:33:12.188Z","avatar_url":"https://github.com/Briuor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rflowz\n\n\u003e React library for building flowcharts and diagrams\n\n[![NPM](https://img.shields.io/npm/v/rflowz.svg)](https://www.npmjs.com/package/rflowz) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Install\n\n```bash\nnpm install rflowz\n```\n\n## Usage\n### Basic Usage\n\u003cp align=\"center\"\u003e \n  \u003cimg style=\"border-radius: 5px\" src=\"https://github.com/Briuor/rflowz/blob/master/media/demo-rflowz.gif?raw=true\"\u003e\n\u003c/p\u003e\n\n```jsx\nimport React from 'react';\nimport RFlowz, { useNodeState } from 'rflowz';\nimport 'rflowz/dist/index.css';\n\nconst DefaultNode = ({ data }) =\u003e \u003cdiv className='node'\u003e{data.labelPrefix} Node\u003c/div\u003e;\n\nexport default function App() {\n  const [nodes, setNodes] = useNodeState([\n    {\n      id: '1',\n      x: 100,\n      y: 200,\n      component: DefaultNode,\n      data: { labelPrefix: 'First' },\n      nextNodeIds: ['2']\n    },\n    {\n      id: '2',\n      x: 425,\n      y: 224,\n      component: DefaultNode,\n      data: { labelPrefix: 'Second' },\n      nextNodeIds: []\n    }\n  ]);\n\n  return (\n    \u003cdiv style={{ width: '100%', height: '100vh' }}\u003e\n      \u003cRFlowz nodes={nodes} /\u003e\n    \u003c/div\u003e\n  );\n}\n```\n### Passing Events to Node Component\n\u003cp align=\"center\"\u003e \n  \u003cimg style=\"border-radius: 5px\" src=\"https://github.com/Briuor/rflowz/blob/master/media/demo-event-rflowz.gif?raw=true\"\u003e\n\u003c/p\u003e\n\n```jsx\nimport React, { useEffect } from 'react';\nimport RFlowz, { useNodeState } from 'rflowz';\nimport 'rflowz/dist/index.css';\n\nconst StartNode = ({ data }) =\u003e (\n  \u003cdiv className='node'\u003e\n    Generate a random value\n    \u003cdiv\n      onClick={data.generateRandomValue}\n      className='random-btn'\n      role='button'\n    \u003e\n      Click Me\n    \u003c/div\u003e\n  \u003c/div\u003e\n);\n\nconst ResultNode = ({ data }) =\u003e (\n  \u003cdiv className='node'\u003eResult: {data.randomValue}\u003c/div\u003e\n);\n\nexport default function EventExample() {\n  const [nodes, setNodes] = useNodeState([]);\n\n  useEffect(() =\u003e {\n    const generateRandomValue = (e) =\u003e {\n      setNodes((nds) =\u003e\n        nds.map((node) =\u003e {\n          if (node.id === 'result') {\n            const newNode = {\n              ...node,\n              data: {\n                ...node.data,\n                randomValue: Math.round(Math.random() * 999) + 1\n              }\n            };\n            return newNode;\n          }\n\n          return node;\n        })\n      );\n    };\n\n    setNodes([\n      {\n        id: 'start',\n        x: 100,\n        y: 200,\n        component: StartNode,\n        data: {\n          generateRandomValue: generateRandomValue\n        },\n        nextNodeIds: ['result']\n      },\n      {\n        id: 'result',\n        x: 425,\n        y: 224,\n        component: ResultNode,\n        data: {\n          randomValue: 1\n        },\n        nextNodeIds: []\n      }\n    ]);\n  }, [setNodes]);\n\n  return (\n    \u003cdiv style={{ width: '100%', height: '100vh' }}\u003e\n      \u003cRFlowz nodes={nodes} /\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\n## API\n\n### RFlowz\n**Important:** The RFlowz height is controlled by it's parent element.\n```jsx\n\u003cdiv style={{ width: '100%', height: '100vh' }}\u003e\n  \u003cRFlowz nodes={nodes} /\u003e\n\u003c/div\u003e\n```\n#### props\n- **nodes**\nType: Node[]\n\n\n### Nodes\n\n```js\nconst nodes = [{\n  id: '1',\n  x: 100,\n  y: 200,\n  component: CustomNode,\n  data: { title: 'Node Title' },\n  nextNodeIds: ['2']\n}];\n```\n- **id (required)**\nDescription: Unique identifier\nType: string\n- **x (required)**\nType: number\n- **y (required)**\nType: number\n- **component (required)**\nType: React.Component\n- **data**\nType: Object\n- **nextNodeIds**\nType: string[]\n- **arrowColor**\nType: string\n### Hooks\n- #### useNodeState\n  ##### Usage\n  ```js\n  import RFlowz, { useNodeState } from 'rflowz';\n\n  function Component() {\n    const [nodes, setNodes] = useNodeState([]);\n    ...\n  }\n  ```\n  ##### Typescript\n  ```ts\n  import RFlowz, { useNodeState, Node } from 'rflowz';\n\n  function Component() {\n    const [nodes, setNodes] = useNodeState\u003cNode[]\u003e([]);\n    ...\n  }\n  ```\n\n## License\n\nMIT © [Briuor](https://github.com/Briuor)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriuor%2Frflowz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbriuor%2Frflowz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriuor%2Frflowz/lists"}