Skip to content

Commit b9d84c6

Browse files
authored
Merge pull request #278 from jgraph/package-diagrams-post
Blog post and minor updates
2 parents 5474dbd + 4aab37a commit b9d84c6

33 files changed

+122
-20
lines changed

_posts/2020-04-15-mermaid-diagrams.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Many developers prefer to describe their data structures and processes using tex
1515

1616
## Insert a Mermaid diagram
1717

18-
1. Click _Arrange > Insert > Advanced > Mermaid_. Alternatively, click the ``+`` icon in the toolbar, then select _Advanced > Mermaid_.
19-
<br /><img src="/assets/img/blog/insert-mermaid-menu.png" style="max-width:100%;height:auto;" alt="Click Arrange > Insert > Advanced > Mermaid to create a diagram from Mermaid Markdown-inspired code">
20-
2. Paste your text into the text box, then click _Insert_.
18+
1. Click _Arrange > Insert > Mermaid_. Alternatively, click the ``+`` icon in the toolbar, then select _Mermaid_.
19+
<br /><img src="/assets/img/blog/insert-mermaid-menu.png" style="max-width:100%;height:auto;" alt="Click Arrange > Insert > Mermaid to create a diagram from Mermaid Markdown-inspired code">
20+
1. Paste your text into the text box, then click _Insert_.
2121
<br /><img src="/assets/img/blog/mermaid-flowchart-example-code.png" style="width=100%;max-width:400px;height:auto;" alt="Paste the text in Mermaid syntax, then click Insert">
2222

2323
Your diagram will be automatically created and formatted from your text, and inserted as a single shape on the drawing canvas.

_posts/2021-07-09-dependency-graphs.md

Lines changed: 3 additions & 4 deletions
Large diffs are not rendered by default.

_posts/2022-10-21-diagrams-from-code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ To recreate the entities, you'll need to delete the existing entities and their
3939

4040
Mermaid can describe a wider range of diagrams, not just UML. Its Markdown-like syntax is very easy to write and supported by several popular platforms.
4141

42-
1. Click _Arrange > Insert > Advanced > Mermaid_.
42+
1. Click _Arrange > Insert > Mermaid_.
4343
<br /><img src="/assets/img/blog/mermaid-flowchart-example-code.png" style="width=100%;max-width:300px;height:auto;" alt="Paste the text in Mermaid syntax, then click Insert">
4444
1. Add the Mermaid syntax description in the large text field.
4545
2. Click _Insert_ and the diagram will be generated and added as a 'shape' on the drawing canvas.

_posts/2024-06-11-mermaid-elk-layout.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ tags: [integrations,uml]
88
categories: [integrations,features,use-cases, import]
99
---
1010

11-
Mermaid is a text-based syntax that you can use to describe a diagram, and automatically lay it out neatly on the diagram canvas. Enter your Mermaid diagram description in draw.io via _Arrange > Insert > Advanced > Mermaid_ in the draw.io menu or _+ > Advanced > Mermaid_ from the toolbar. draw.io has updated to Mermaid version 10.9.1 to support the new ELK automatic layout.
11+
Mermaid is a text-based syntax that you can use to describe a diagram, and automatically lay it out neatly on the diagram canvas. Enter your Mermaid diagram description in draw.io via _Arrange > Insert > Mermaid_ in the draw.io menu or _+ > Mermaid_ from the toolbar. draw.io has updated to Mermaid version 10.9.1 to support the new ELK automatic layout.
1212
<br /><img src="/assets/img/blog/mermaid-flow-elk-insert.png" style="width=100%;max-width:350px;height:auto;" alt="Tell the Mermaid diagram generation tool to use the ELK layout option in your text diagram description">
1313

1414
## Text to diagram tools in draw.io
@@ -39,10 +39,10 @@ graph TD
3939
```
4040
Add this Mermaid diagram to draw.io.
4141

42-
1. Select _Arrange > Insert > Advanced > Mermaid_ from the menu or _+ > Advanced > Mermaid_ from the toolbar if you are using the [Simple mode](/blog/simple-mode-diagrams.html) or the [Sketch editor theme](/blog/sketch-online-whiteboard.html).
43-
<br /><img src="/assets/img/blog/insert-mermaid-menu.png" style="max-width:100%;height:auto;" alt="Click Arrange > Insert > Advanced > Mermaid to create a diagram from Mermaid Markdown-inspired code">
44-
2. Enter the text description of your diagram using Mermaid syntax in the large text box.
45-
3. From the drop-down list, select whether you want to insert the diagram with draw.io shapes (_Diagram_), or as a single image (_Image_), and click _Insert_.
42+
1. Select _Arrange > Insert > Mermaid_ from the menu or _+ > Mermaid_ from the toolbar if you are using the [Simple mode](/blog/simple-mode-diagrams.html) or the [Sketch editor theme](/blog/sketch-online-whiteboard.html).
43+
<br /><img src="/assets/img/blog/insert-mermaid-menu.png" style="max-width:100%;height:auto;" alt="Click Arrange > Insert > Mermaid to create a diagram from Mermaid Markdown-inspired code">
44+
1. Enter the text description of your diagram using Mermaid syntax in the large text box.
45+
2. From the drop-down list, select whether you want to insert the diagram with draw.io shapes (_Diagram_), or as a single image (_Image_), and click _Insert_.
4646
<br /><img src="/assets/img/blog/mermaid-flowchart-example-code.png" style="width=100%;max-width:400px;height:auto;" alt="Paste the text in Mermaid syntax, then click Insert">
4747

4848
**Diagram** (default): When you insert the Mermaid diagram using the draw.io shapes, you can connect additional shapes and connectors and style your diagram. To change the original Mermaid syntax, first delete the previously inserted shapes, and re-enter the Mermaid description of your diagram by repeating the steps above.

_posts/2024-10-18-uml-diagram-tools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ See the [draw.io diagram repository on GitHub](https://github.com/jgraph/drawio-
7171

7272
[Mermaid](/blog/mermaid-diagrams.html) is a popular text-based UML diagramming tools and supported by draw.io. Many developers find describing sequence diagrams in particular easier using text.
7373

74-
Click _Arrange > Insert > Advanced > Mermaid_.
74+
Click _Arrange > Insert > Mermaid_.
7575

7676
For example, the following Mermaid text generates a sequence diagram.
7777
```
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
layout: post
3+
author: draw.io
4+
slug: uml-package-diagrams
5+
date: 2025-07-30 09:43:00
6+
title: How to draw UML package diagrams
7+
tags: [shape libraries, uml]
8+
categories: [use-cases, templates, shape-libraries]
9+
---
10+
11+
UML package diagrams document the structure of grouped components in a system along with their dependencies, especially for multi-layered web and application architectures. Package diagrams fall in between the detailed [class diagrams](/blog/uml-class-diagrams.html) and the high-level more abstract [profile diagrams](/blog/uml-profile-diagrams.html) and model diagrams.
12+
<br /><img src="/assets/img/blog/uml-package-example.png" style="width=100%;max-width:600px;height:auto;" alt="A simple UML package diagram to show ">
13+
14+
Packages of 'third-party' code are often used in software projects, reducing the need to develop the entire system in-house. While [UML diagrams](/blog/uml-overview.html) are commonly used for documenting software code in detail, several abstract types of UML diagrams can provide a clear overview of any type of medium to large system or complex service.
15+
16+
By drawing the system structured into packages, it is easier to identify where components could be externally sourced or re-used in other projects.
17+
18+
**Tip:** UML diagrams aren't limited to programming - you can document any system or service by grouping subsystems, service bundles, departments, and components into packages for a structured overview.
19+
20+
**Enable the UML 2.5 shape library in draw.io**
21+
22+
Type ``package`` into the search field and press ``Enter`` to see all package shapes.
23+
<br /><img src="/assets/img/blog/uml-package-search.png" style="width=100%;max-width:350px;height:auto;" alt="Search for package shapes to quickly draw a package diagram in draw.io without enabling shape libraries">
24+
25+
You may find the other shapes and connectors in the UML shape libraries useful.
26+
27+
1. Click on _More Shapes_ at the bottom of the shapes panel.
28+
2. In the _Software_ section, click on the checkboxes next to the _UML2.5_ and _UML_ shape libraries and click _Apply_.
29+
3. In the shapes panel, you can now see the libraries. Hover over any shape to see its name and a larger preview.
30+
<br /><img src="/assets/img/blog/uml-package-library-shapes.png" style="width=100%;max-width:500px;height:auto;" alt="The UML 2.5 shape library contains most of the useful package shapes in draw.io">
31+
32+
The _SysML_ shape library in the _Business_ section also contains a number of package shapes.
33+
<br /><img src="/assets/img/blog/uml-package-sysml-library.png" style="width=100%;max-width:500px;height:auto;" alt="The SysML shape library also contains a number of package shapes you can use in your UML diagrams">
34+
35+
**Can I generate this diagram?**
36+
37+
[Mermaid syntax](https://mermaid.js.org/intro/) - the format that most diagram generators use - doesn't currently define package diagrams, but it does support UML class, sequence, and state diagrams.
38+
39+
The [smart templates feature](/blog/smart-diagram-generation.html) in draw.io can provide inspiration for a package diagram as a class diagram, which may be useful when designing a new, large system from scratch.
40+
41+
Keep in mind that the generator doesn't currently understand the package diagram syntax or shapes and cannot know anything about existing components in your system or third-party offerings that could be used as a 'package', so you will need to edit a generated diagram heavily.
42+
43+
[_How to write good queries for smart templates_](/blog/write-query-generate-diagram.html)
44+
45+
## Components of a package diagram
46+
47+
**Package:** a container for classes and interfaces. The label can be either in the package tab when the package shape contains other elements, or in the middle of the shape if its elements or contained packages are not drawn.
48+
49+
<img src="/assets/img/blog/uml-package-shapes.png" style="width=100%;max-width:600px;height:auto;" alt="A simple UML package diagram to show ">
50+
51+
**Dashed connectors:** a dependency between packages. You can add an optional label inside angle brackets to signify various types of dependency: ``<<needs>>``, ``<<use>>``, ``<<import>>``, ``<<access>>`` or ``<<merge>>``. Make sure there are no cycles in merge dependencies.
52+
53+
**Element:** a single element within a package. An element may be a fully contained package, a class, an interface or a subsystem. While package diagrams are generally a simple representation of the static system structure, highlighting an internal element can be useful to show its importance.
54+
55+
**Combining package and class diagrams:** detail classes inside their package shapes. However, this would only be practical for small systems or to highlight a few specific elements within a system.
56+
57+
## UML package diagram examples
58+
59+
In this simple example of an online shop, the system's elements are separated into one package containing the web and mobile app interface, packages for the shopping cart and payment systems, and one package containing all the databases.
60+
<br /><img src="/assets/img/blog/package-diagram-example.png" style="width=100%;max-width:300px;height:auto;" alt="A simple UML package diagram to show ">
61+
62+
This example can be extended into a medium-level overview of a larger company that develops products and sells them both in their physical stores and online in their web app and mobile app. This company employs third-party services for photography, video creation and shipping.
63+
64+
While this is likely more detailed than most package diagrams as it shows business and application package 'layers' as well the store-related packages, it does illustrate how elements of a more complex business system can be grouped into logical packages.
65+
<br /><img src="/assets/img/blog/uml-package-example.png" style="width=100%;max-width:600px;height:auto;" alt="A simple UML package diagram to show ">
66+
67+
68+
69+
## Other types of UML diagrams
70+
71+
The UML specification allows you to draw many different types of diagrams to model the behaviour and data of a system in different ways.
72+
73+
Refer to the [UML diagram overview post](/blog/uml-overview.html) for details of the many other types of UML diagrams.
74+
75+
[<img src="/assets/img/blog/uml-2-5-diagram-overview.png" style="width=100%;max-width:500px;height:auto;" alt="Diagram types defined in UML 2.5">](https://app.diagrams.net/?lightbox=1&highlight=0000ff&edit=_blank&layers=1&nav=1&title=#Uhttps%3A%2F%2Fraw.githubusercontent.com%2Fjgraph%2Fdrawio-diagrams%2Fdev%2Fexamples%2Fconcept-map-uml-diagrams-overview.drawio)
69.8 KB
Loading
128 KB
Loading
96.8 KB
Loading
248 KB
Loading

0 commit comments

Comments
 (0)