Drawing UML diagrams

Draw sequence, activity, use case and state diagrams with the UML sections of the Shapes panel, frames and UML arrow styles. Everything is an ordinary shape or arrow, or you can start from Mermaid.

The UML sections#

Each section holds everything its kind of diagram needs, so items such as Note and Fork / join appear in several. The sections start collapsed, and search finds their items by name, such as lifeline or fork, or all of them with uml.

SectionItems
UML sequenceLifeline, Actor lifeline, Activation, Combined fragment, Operand divider, Destroy, Found / lost message, Note, Diagram frame
UML activityInitial node, Action, Decision / merge, Fork / join, Object, Send signal, Accept event, Time event, Activity final, Flow final, Swimlane, Activity frame, Note
UML use caseActor, Use case, System boundary, Note
UML stateInitial state, State, Composite state, Region divider, Choice, Junction, Fork / join, History, Deep history, Entry point, Exit point, Terminate, Final state, Note

Actors, initial and final nodes and states, forks, time events, junctions, entry and exit points, Destroy and Terminate show their label under the shape. A Note works like a sticky note. Press / to add any of them from the keyboard.

Arrows for UML relationships#

Set these in the style toolbar's Arrows section:

RelationshipLine styleArrowheadsArrowhead style
Synchronous message, control flow, state transitionSolidEndFilled
Asynchronous messageSolidEndOpen
ReplyDashedEndOpen
Association between an actor and a use caseSolidNo heads
Include or extend, labeled «include» or «extend»DashedEndOpen
GeneralizationSolidEndHollow
Lost messageSolidEndCross

Set the style with nothing selected and every new arrow gets it. See Style for new items.

Sequence diagrams#

  1. Add a Lifeline or Actor lifeline per participant, side by side, and type its name.
  2. Point at a lifeline's dashed line at the message's height, and drag the handle that appears onto another lifeline's line. Messages snap onto the line and stay level. For a message to itself, drag out and back onto the same line further down.
  3. Double-click the message to label it.
  • Activation: place it on a lifeline's line and attach messages to its sides.
  • Combined fragment: drag it over messages and label it with the operator, such as loop, alt, opt or par. Add an Operand divider for each else or and, labeled with its guard.
  • Destroy ends a lifeline. Found / lost message is the dot where a message from or to outside the diagram starts or ends.
  • Diagram frame, labeled sd and a name, names the interaction.

Resizing a lifeline keeps its messages in place, so stretch lifelines as the diagram grows. Lifelines take clicks only on their box and near their line, so you can select and box-select over them. Messages don't move on their own: to fit one in, move the ones below it down first.

Activity diagrams#

Start from an Initial node and connect Actions. Branch with a Decision / merge and label each outgoing arrow with its guard, such as [in stock]. Split and join parallel flows with Fork / join, tall and narrow for a left-to-right flow. End with an Activity final, or a Flow final for a flow that ends on its own. Put Swimlanes side by side, and an Activity frame around everything to name the activity.

Use case diagrams#

Put the Use cases inside a System boundary and the Actors outside it, and connect actors to their use cases with associations. Draw include and extend arrows between use cases, and generalizations between actors or between use cases.

State diagrams#

Connect States with transitions labeled event [guard] / action, from an Initial state to Final states, or to a Terminate. Branch with a Choice, chain transitions through a Junction, and nest states in a Composite state, with a Region divider between concurrent regions and Entry point and Exit point on its border. History (H) and Deep history (H*) return to a composite state's last state.

Frames#

Combined fragments, diagram frames, swimlanes, activity frames, system boundaries and composite states are frames: groups without an icon. Like other groups, they contain what's inside them, and you select a frame by its border or label.

From Mermaid#

Paste a Mermaid sequenceDiagram, stateDiagram-v2 or usecase-beta onto the canvas, or a flowchart that uses the start, stop, fork and cross-circ shapes for an activity diagram. Lineout lays it out with the shapes, frames and arrows on this page. Add from Mermaid… in the code panel and New page from Mermaid in ⌘K take the same text. See Mermaid diagrams.

In JSON, UML shapes are shape nodes, frames are groups with a frame, and arrowhead styles are the arrow style's headShape.