Enterprise diagram editors need more than shapes and connectors. An order workflow needs valid relationships, edits that follow application permissions, and a saved document that can move between tools.

Diagram 1.0.0 brings those capabilities to PrimeUI Pro for Angular. The first stable release includes:

  • A typed document model with validation and atomic transactions.
  • Managed editing or application approval before a change becomes committed state.
  • Pages, layers, swimlanes, and automatic layout.
  • BPMN, UML class, ER, activity, and sequence notation profiles.
  • Native JSON persistence and BPMN XML interchange.
  • Rendered SVG, PNG, JPEG, and print output.

A document model beneath the Angular components

The saved DiagramModel contains JSON-safe pages, layers, nodes, and connectors. Your Angular templates render the node content. The workflow editor below adds copied toolbar, palette, and inspector parts around that canvas.

Dark-mode workflow editor with a service review process, decision branches, toolbar, and shape and inspector controls

A smaller editor starts with a model and a viewport. Save this as model.ts; the following examples reuse it.

import type { DiagramModel } from '@primeui/angular-diagram';

export const model: DiagramModel = {
    schemaVersion: 1,
    id: 'review-workflow',
    pages: [{ id: 'page', name: 'Review' }],
    layers: [{ id: 'steps', pageId: 'page', name: 'Steps' }],
    nodes: [
        {
            id: 'review',
            type: 'task',
            pageId: 'page',
            layerId: 'steps',
            bounds: { x: 40, y: 40, width: 180, height: 100 },
            rotation: 0,
            ports: [],
            labels: [],
            data: { title: 'Review order' }
        }
    ],
    connectors: []
};
import { Component } from '@angular/core';
import { DiagramModule } from '@primeui/angular-diagram';
import { model } from './model';

@Component({
    selector: 'review-editor',
    imports: [DiagramModule],
    template: `
        <p-diagram-root [value]="model" pageId="page">
            <strong *pDiagramNodeDef="'task'; let node = node">
                {{ node.data?.['title'] }}
            </strong>
            <p-diagram-viewport label="Order review" [autoFit]="true" style="display: block; height: 24rem" />
        </p-diagram-root>
    `
})
export class ReviewEditor {
    readonly model = model;
}

[value] creates a managed store that owns the document and Undo history. Each root keeps its own selection, tools, pan, and zoom, even when roots share a store. Bind exactly one source: [value] or an application-owned [store]. A new [value] reference reloads the document with fresh history.

The editor shell is optional. PrimeOne and Tailwind UI parts are copied into your project, so you can change the panels and node templates independently. The architecture guide explains that composition and the store’s lifecycle.

The application decides which edits become state

Controlled mode turns an edit into a proposal. The committed snapshot stays unchanged until the application accepts it. That gives a permissions check or an approval service a place to decide whether a move becomes saved state.

Controlled-state graph and status showing a pending move proposal at base revision 0 while committed x remains 40 and revision remains 0

This module reuses model.ts. Bind its store to the root. The subscription receives proposals; your approval UI or service calls decide with its decision.

import { createDiagramStore, type DiagramProposal } from '@primeui/angular-diagram';
import { model } from './model';
const created = createDiagramStore(model, { mode: 'controlled' });
if (!created.ok) throw new Error(JSON.stringify(created.diagnostics));
export const store = created.value;
export const unsubscribe = store.subscribeProposals((proposal) => console.info(proposal));
export function decide(proposal: DiagramProposal, accepted: boolean) {
    const result = store.acknowledge(
        accepted
            ? {
                  transactionId: proposal.id,
                  status: 'accepted',
                  baseRevision: proposal.baseRevision,
                  revision: proposal.baseRevision + 1
              }
            : {
                  transactionId: proposal.id,
                  status: 'rejected',
                  baseRevision: proposal.baseRevision
              }
    );
    console.info(result.status, result.diagnostics);
}

Acceptance uses the proposal’s exact ID and base revision. A stale response does not commit the candidate, and rejection leaves the document unchanged. Call unsubscribe() and store.dispose() after borrowing views detach. The controlled-state guide covers asynchronous approval and cleanup.

Validation reports a code, path, and message for the failing record. Transactions are atomic, and a completed drag creates one Undo entry. Selection and pan stay outside document history.

BPMN from the palette to XML

BPMN authoring uses the same document, selection, and history as the generic canvas. Its palette supplies tasks, events, gateways, and other supported profiles. A task carries its process and scope, while a sequence flow carries its relationship semantics.

Dark-mode BPMN process with a Message Start event, Review order user task, Complete end event, and sequence flows

Install createDiagramBpmnModule() from @primeui/angular-diagram/bpmn in the store’s notationModules. Register createDiagramBpmnLibrary().symbols in a DiagramSymbolRegistry, then pass that registry to the root’s [symbols] input. The module validates notation records and later edits. The palette and inspector submit typed actions through those rules, including process ownership and flow scope. Structurally valid unfinished diagrams can keep completeness warnings.

The BPMN basics demo contains the complete palette, store, and inspector setup. The resulting model can also be read or written as BPMN XML, with diagram geometry included. This standalone helper checks an incoming document and returns XML for its parsed model. Both operations report diagnostics.

import { readDiagramBpmnXml, writeDiagramBpmnXml } from '@primeui/angular-diagram/bpmn-xml';

export function inspectBpmn(xml: string) {
    const read = readDiagramBpmnXml(xml);
    console.info(read.diagnostics);
    if (!read.ok) return;
    const written = writeDiagramBpmnXml(read.model);
    console.info(written.diagnostics);
    if (written.ok) return written.xml;
}

For an editor import, DiagramBpmnXmlImportController previews the file and accepts the replacement through the store’s editing policy. The BPMN XML guide shows that review flow and the supported interchange profile.

Pages, swimlanes, and layout

Pages hold independent graphs. Layers control visibility and locking within a page. Groups and containers keep child coordinates local, so related content moves together. Swimlanes add pools, lanes, and optional phases to the same document and history.

Customer delivery swimlane pool with Intake and Fulfillment lanes joined by a routed request connector

Layout is an explicit edit. Add DiagramLayout from @primeui/angular-diagram/layout to the first component’s imports and replace its template with this fragment, which reuses its model field.

<p-diagram-root [value]="model" pageId="page" [diagramLayout]="{}" #layout="diagramLayout">
    <button type="button" (click)="layout.run()">Arrange graph</button>
    <p-diagram-viewport label="Review layout" style="height: 24rem" />
</p-diagram-root>

The default layered provider arranges directed graphs. Tree and force providers handle forests and networks. An accepted layout becomes one Undo action; connector routing is a separate operation.

The schema modeler combines ER entities, fields, and relationships in an editor with its own panels. Notation rules and document organization use the same store.

Dark-mode ER schema modeler showing Customer, Order, Product, and OrderLine entities with field relationships and routed connectors

See pages and layers, swimlanes, and layouts for the individual controls and providers.

Export the rendered diagram

Rendered export captures the viewport’s Angular HTML, CSS, images, and nested SVG, including eligible read-only offscreen templates. Editor controls stay outside the output. Native JSON persistence saves the document model and application data.

Rendered export demo with SVG output controls and custom Angular review cards containing an avatar, icon, and nested SVG chart

Call this helper from an Angular button handler after the viewport and its data have rendered. Pass the mounted DiagramViewport and the current store snapshot. It returns one SVG document per exported page.

import type { DiagramModel, DiagramViewport } from '@primeui/angular-diagram';
import { exportDiagramSvg } from '@primeui/angular-diagram/export';

export async function svg(view: DiagramViewport, snapshot: DiagramModel) {
    const result = await exportDiagramSvg(snapshot, { pageIds: ['page'] }, view.exportSource());
    if (!result.ok) throw new Error(JSON.stringify(result.diagnostics));
    return result.value;
}

DiagramRasterExport provides PNG and JPEG downloads. Diagram also prepares print sheets. The export guide contains complete download examples. For automated files, an Angular export route plus Playwright renders the templates and saves SVG or raster output. Use the headless-browser recipe for that setup.

Accessibility

The named viewport supports keyboard navigation, selection, and editing commands. See the keyboard and accessibility references for shortcuts, focus, and text alternatives.

Getting a diagram on screen

In an Angular 22 application, install the Angular package:

npm install @primeui/[email protected]

Follow Setup for licensing and styles, then use the model and component above. Load @primeui/angular-diagram/themes/primeone.css before @primeui/angular-diagram/style.css in your global stylesheet. Both copied UI presets use these shared styles. Explore the running examples in the Angular showcase.

The React and Vue Diagram alphas, @primeui/[email protected] and @primeui/[email protected], are ready and in active development.