1 | # bpmn-js - BPMN 2.0 for the web
|
2 |
|
3 | [![Build Status](https://github.com/bpmn-io/bpmn-js/workflows/CI/badge.svg)](https://github.com/bpmn-io/bpmn-js/actions?query=workflow%3ACI)
|
4 |
|
5 | View and edit BPMN 2.0 diagrams in the browser.
|
6 |
|
7 | [![bpmn-js screencast](./resources/screencast.gif "bpmn-js in action")](http://demo.bpmn.io/s/start)
|
8 |
|
9 | ## Installation
|
10 |
|
11 | Use the library [pre-packaged](https://github.com/bpmn-io/bpmn-js-examples/tree/main/pre-packaged)
|
12 | or include it [via npm](https://github.com/bpmn-io/bpmn-js-examples/tree/main/bundling)
|
13 | into your node-style web-application.
|
14 |
|
15 | ## Usage
|
16 |
|
17 | To get started, create a [bpmn-js](https://github.com/bpmn-io/bpmn-js) instance
|
18 | and render [BPMN 2.0 diagrams](https://www.omg.org/spec/BPMN/2.0.2/) in the browser:
|
19 |
|
20 | ```javascript
|
21 | const xml = '...'; // my BPMN 2.0 xml
|
22 | const viewer = new BpmnJS({
|
23 | container: 'body'
|
24 | });
|
25 |
|
26 | try {
|
27 | const { warnings } = await viewer.importXML(xml);
|
28 |
|
29 | console.log('rendered');
|
30 | } catch (err) {
|
31 | console.log('error rendering', err);
|
32 | }
|
33 | ```
|
34 |
|
35 | Checkout our [examples](https://github.com/bpmn-io/bpmn-js-examples) for many
|
36 | more supported usage scenarios.
|
37 |
|
38 | ### Dynamic Attach/Detach
|
39 |
|
40 | You may attach or detach the viewer dynamically to any element on the page, too:
|
41 |
|
42 | ```javascript
|
43 | const viewer = new BpmnJS();
|
44 |
|
45 | // attach it to some element
|
46 | viewer.attachTo('#container');
|
47 |
|
48 | // detach the panel
|
49 | viewer.detach();
|
50 | ```
|
51 |
|
52 | ## Resources
|
53 |
|
54 | * [Demo](http://demo.bpmn.io)
|
55 | * [Issues](https://github.com/bpmn-io/bpmn-js/issues)
|
56 | * [Examples](https://github.com/bpmn-io/bpmn-js-examples)
|
57 | * [Forum](https://forum.bpmn.io)
|
58 | * [Changelog](./CHANGELOG.md)
|
59 |
|
60 | ## Build and Run
|
61 |
|
62 | Prepare the project by installing all dependencies:
|
63 |
|
64 | ```sh
|
65 | npm install
|
66 | ```
|
67 |
|
68 | Then, depending on your use-case you may run any of the following commands:
|
69 |
|
70 | ```sh
|
71 | # build the library and run all tests
|
72 | npm run all
|
73 |
|
74 | # spin up a single local modeler instance
|
75 | npm start
|
76 |
|
77 | # run the full development setup
|
78 | npm run dev
|
79 | ```
|
80 |
|
81 | You may need to perform [additional project setup](./docs/project/SETUP.md) when
|
82 | building the latest development snapshot.
|
83 |
|
84 | ## Related
|
85 |
|
86 | bpmn-js builds on top of a few powerful tools:
|
87 |
|
88 | * [bpmn-moddle](https://github.com/bpmn-io/bpmn-moddle): Read / write support for BPMN 2.0 XML in the browsers
|
89 | * [diagram-js](https://github.com/bpmn-io/diagram-js): Diagram rendering and editing toolkit
|
90 |
|
91 | ## License
|
92 |
|
93 | Use under the terms of the [bpmn.io license](http://bpmn.io/license).
|