# Sequence Diagram Layout ## Core Elements | Element | Visual | Description | |---------|--------|-------------| | Actor/Participant | Box at top + dashed vertical lifeline | Each entity in the interaction | | Sync message | Solid arrow → | Request or call | | Async message | Open arrowhead → | Fire-and-forget | | Return message | Dashed arrow ← | Response | | Activation bar | Narrow filled rect on lifeline | Entity is processing | | Self-message | Arrow looping back to same lifeline | Internal processing | | Note | Rounded rect with folded corner | Annotation | | Alt/Opt frame | Dashed boundary with label tab | Conditional block | | Loop frame | Dashed boundary with "loop" tab | Repetition | ## Layout Algorithm 1. **Place actors** horizontally across the top, evenly spaced (150-200px apart) 2. **Draw lifelines** as vertical dashed lines from each actor box downward 3. **Place messages** as horizontal arrows between lifelines, top to bottom in time order 4. **Vertical spacing** between messages: 40-50px 5. **Activation bars:** 10px wide, centered on lifeline, spanning from incoming to outgoing message ## Actor Box ```svg Actor Name ``` ## Message Arrows ```svg methodCall() response process() ``` ## Activation Bar ```svg ``` ## Conditional / Loop Frames ```svg alt [condition] [else] ``` ## Numbering For complex sequences (8+ messages), number each message: ```svg 1 ``` ## Color Assignment Assign each actor a distinct color from the palette. Use that color for: - Actor box stroke - Activation bar on that lifeline - Outgoing arrows from that actor (optional, for visual clarity in complex diagrams)