← Back to Yappy
Yappy Documentation

UML Shapes

Create professional UML diagrams including class diagrams, use case diagrams, sequence diagrams, state machines, and component diagrams.

Available UML Shapes

ShapeDiagram TypePurpose
Class BoxClass DiagramRepresents a class with attributes and methods
InterfaceClass DiagramInterface definition
ActorUse CaseExternal entity interacting with the system
Use CaseUse CaseA system function or feature
LifelineSequenceObject's existence over time
Activation BarSequencePeriod of active processing
StateState MachineA state in the state machine
ComponentComponentA modular software component
PackagePackageGroups related elements
NoteAllComments and annotations

How to (in the app)

Place a UML shape

  1. Open the Architecture toolbar group and choose the UML section (Class, Use Case, Sequence, State, Component, Deployment).
  2. Click the shape you want (e.g. Class Box), then click or drag on the canvas to place and size it.
  3. Double-click the shape to edit its text — for a class box, type the name, attributes and methods on separate lines.
  4. Restyle fill, stroke and text from the Properties panel on the right; both sketch and architectural render styles are supported.

Connect shapes with UML relationships

  1. Pick the Arrow tool (A) and drag from one shape to another — hover an edge to snap to a connection point.
  2. With the connector selected, choose the arrowhead / line style (open arrow, hollow triangle, filled/hollow diamond, dashed) from the Properties panel to express association, inheritance, composition, aggregation, dependency or implementation.
  3. Double-click the connector to add cardinality or role labels (e.g. 10..*).
Faster: generate from text

For a whole diagram at once, open the Import Diagram dialog and paste Mermaid (classDiagram, sequenceDiagram, stateDiagram) or native YSL — Yappy lays out the shapes and draws the correct UML arrowheads automatically. Everything stays editable on the canvas afterwards.

Class Diagrams

Model the static structure of a system showing classes, their attributes, methods, and relationships.

Class Box Structure

┌─────────────────────┐
│     ClassName       │  ← Class name (bold)
├─────────────────────┤
│ - privateAttr: Type │  ← Attributes
│ + publicAttr: Type  │
├─────────────────────┤
│ + method(): RetType │  ← Methods
│ - helper(): void    │
└─────────────────────┘

Visibility Modifiers

SymbolVisibility
+Public
-Private
#Protected
~Package

Relationships

When you import a Mermaid classDiagram, each relationship arrow renders with its proper UML arrowhead (not just a text label). The decoration lands on the correct end automatically — the hollow triangle on the base class, the diamond on the whole/aggregate, the open arrow on the target.

Mermaid SyntaxArrow StyleRelationship
A --> BSolid line, open arrowAssociation
A *-- BSolid line, filled diamondComposition
A o-- BSolid line, hollow diamondAggregation
A ..> BDashed line, open arrowDependency
A <|-- BSolid line, hollow triangleInheritance
A <|.. BDashed line, hollow triangleImplementation

Reversed forms (B --|> A, B --* A, B --o A) and navigable composites/aggregates (A *--> B, A o--> B) are also recognised, and optional cardinality/role labels are preserved, e.g. Subject "1" o-- "0..*" Observer : observers.

Use Case Diagrams

Show system functionality from a user's perspective. Identify actors and the use cases they interact with.

Elements

  • Actor (stick figure) - External entity (user, system)
  • Use Case (ellipse) - System function
  • System boundary (rectangle) - Scope of the system

Relationships

  • Association - Actor participates in use case
  • Include - Use case includes another (dashed arrow)
  • Extend - Optional extension of a use case
  • Generalization - Inheritance between actors/use cases

Sequence Diagrams

Show how objects interact over time through message passing.

Elements

ElementDescription
LifelineVertical dashed line showing object's existence
Activation BarRectangle on lifeline showing active processing
Message (solid arrow)Synchronous method call
Response (dashed arrow)Return value
FragmentGroups messages (loop, alt, opt)
Reading Sequence Diagrams

Time flows from top to bottom. Messages between lifelines show the order of interactions between objects.

Generate from text (DSL)

The fastest way to build a complete sequence diagram is to describe it in the Import Diagram dialog (Mermaid sequenceDiagram syntax or native YSL). Yappy lays out lifelines, cascades the messages, and draws combined fragments, notes and activation bars automatically.

FeatureMermaidYSL
Participant / actorparticipant A as Alice / actor U as Usera [lifeline] "Alice" / u [actor] "User"
Sync call (solid, filled head)A->>B: msga ->> b "msg"
Reply (dashed)B-->>A: okb -->> a "ok"
Async / lostA-)B / A-xBa -> b
Self messageA->>A: thinka ->> a "think"
ActivationA->>+BB-->>-Aactivate bdeactivate b
Loop / opt / breakloop labelendloop "label"end
Alternativesalt condelse otherendalt "cond"else "other"end
Parallelpar aand bendpar "a"and "b"end
NoteNote over A,B: textnote over a,b "text"
Auto-number messagesautonumberautonumber
Known limitations

Lost-message (-x) arrows render with a normal arrowhead (no cross glyph yet), and nested activation bars on the same lifeline are staggered rather than precisely boxed. Generated diagrams are fully editable on the canvas afterwards — drag participants, edit message text, or restyle any element.

State Machine Diagrams

Model the dynamic behavior of an object through its states and transitions.

Elements

  • Initial State - Filled circle (start point)
  • State - Rounded rectangle with state name
  • Transition - Arrow with event/guard/action
  • Final State - Circle with inner filled circle

Transition Syntax

event [guard] / action

Examples:
- click [isEnabled] / doAction()
- timeout / retry()
- submit [isValid]

Component Diagrams

Show the organization and dependencies among software components.

Elements

  • Component - Rectangle with component icon
  • Interface (provided) - Lollipop symbol
  • Interface (required) - Socket symbol
  • Port - Small square on component edge

Deployment Diagrams

Show how software is deployed onto hardware/runtime nodes and which artifacts run where. Find Deployment Node and Artifact in the Architecture toolbar group (UML Structure section), or via DSL with [node] / [artifact].

ElementDescription
Deployment Node3-D box for a device, server or execution environment (label on the front face).
ArtifactRectangle with a folded-corner document icon — a deployable file (e.g. app.jar, a binary, a script).

Both render in sketch and architectural styles and accept full fill / stroke / text styling.

UML Best Practices

  • Keep it simple - Don't try to model everything
  • Use consistent notation - Follow UML conventions
  • Label relationships - Add multiplicities and roles
  • Group related elements - Use packages for organization
  • Add notes - Clarify complex parts with annotations

Scripting (API)

UML shapes are created from the console via the global window.Yappy object using the generic createElement(type, x, y, width, height, options), then connected with createArrow.

// Two classes with an inheritance relationship
const base = Yappy.createElement('umlClass', 200, 80, 180, 120, {
  containerText: 'Shape\\n- x: number\\n- y: number\\n+ area(): number',
});
const sub = Yappy.createElement('umlClass', 200, 260, 180, 120, {
  containerText: 'Circle\\n- r: number\\n+ area(): number',
});
// Sub -> Base (style the arrowhead as a hollow triangle in the panel)
Yappy.createArrow(290, 260, 290, 200);

UML type strings include: umlClass, umlInterface, umlEnum, umlObject, umlActor, umlUseCase, umlLifeline, umlState, umlAction, umlHistory, umlComponent, umlPackage, umlNode, umlArtifact, umlPort, umlProvidedInterface, umlRequiredInterface, umlSignalSend, umlSignalReceive, umlFragment, and umlNote.

Update any shape later with Yappy.updateElement(id, { containerText: '...', backgroundColor: '#f5f5ff' }). For a full diagram from text, prefer the Import Diagram dialog (Mermaid / YSL) described above.