Skip to content

Install

<fluxy-gram> is a standard web component. It works in plain HTML and in every framework (React, Vue, Svelte, Astro, Angular…), with no wrapper.

No install, no bundler:

<script type="module" src="https://cdn.jsdelivr.net/npm/fluxygram@0.1"></script>
<fluxy-gram src="/diagrams/checkout.flux.json"></fluxy-gram>

Point src at a .flux.json file:

<fluxy-gram src="/diagrams/checkout.flux.json"></fluxy-gram>

Or write it inline:

<fluxy-gram>
<script type="application/json">
{ "type": "flow", "nodes": [{ "id": "a", "label": "Start" }, { "id": "b", "label": "Done" }], "edges": [{ "from": "a", "to": "b" }] }
</script>
</fluxy-gram>

Or set it from JavaScript:

document.querySelector('fluxy-gram').diagram = { type: 'flow', nodes: [/* … */], edges: [/* … */] };
// React
import '@fluxygram/element';
export function Checkout() {
return <fluxy-gram src="/diagrams/checkout.flux.json" />;
}
<!-- Vue: tell the compiler it's a custom element (compilerOptions.isCustomElement) -->
<template>
<fluxy-gram src="/diagrams/checkout.flux.json" />
</template>
Package What it is
@fluxygram/element The <fluxy-gram> component. Use it with a bundler.
fluxygram The same component as a single file, for <script> tags and CDNs.
@fluxygram/core The format without the DOM: validation, layout and motion planning. For tools, servers and Workers.
import { validate } from '@fluxygram/core';
const result = validate(json, { locale: 'en' });
if (!result.ok) console.log(result.issues); // [{ path: 'edges[0].to', message: '…' }]