stefanjohansson.org

diagrams with ReactFlow

published: 12/8/2025

written by: Stefan Johansson

2 min read

ReactFlow 🔗 is a powerful open-source library 🔗 for building interactive diagrams and flowcharts in React (or Svelte 🔗) applications.

This post demonstrates ReactFlow diagramming in Astro. These diagrams are fully client-side rendered, making them perfect for a static site hosted on Azure Static Web Apps.

While ReactFlow supports extensive interactivity and diagram creation, including node and edge creation, dragging, zooming, and panning, this post focuses on static diagrams with optional interactivity. This allows a site to publish pre-defined diagrams that can be nicely rendered and explored, without the diagram creation features being front and center.

The component exposes the diagram as an Astro React island, allowing easy integration into Astro pages and posts. A trivial diagram definition is passed as a prop to the component, which then renders the diagram accordingly.

Simple Flow Diagram

Here’s a basic flow diagram showing a simple process:

Tip

Click the expand button in the top-right corner to enter focus mode for a better view of the diagram!

Architecture Diagram

More complex diagrams can show system architectures with multiple branches:

Different Background Styles

The diagram component should support different background patterns:

Cross Pattern

Configuration Options

The Diagram component accepts several configuration options:

Theme Support

The diagrams automatically adapt to the site’s theme. Try switching between light and dark mode using the theme toggle in the footer to see the diagrams adjust their colors accordingly!

Note

All diagrams are rendered entirely client-side, making them perfect for static site hosting. No server-side processing is required.