Skip to content

Views

LikeC4 is model-based. A view is a projection of the model: it picks elements and relationships from the model and renders them as a diagram. When the model changes, every view that shows the changed part is updated.

LikeC4 does not enforce specific rules, such as a strict number of levels or what should be included — it’s entirely up to you and your context.

Kind Keyword Shows
Element view view Elements and relationships of the model, chosen with predicates
Dynamic view dynamic view A scenario as ordered steps between elements, as a diagram or a sequence diagram (dynamic views)
Deployment view deployment view Deployment nodes and the instances deployed to them (deployment views)

This page covers what all views share. The next pages explain:

  • Predicates - what an element view shows
  • Styles - how elements look in a view, and how to share styles between views
  • Dynamic views - scenarios as steps, diagram or sequence
  • Layout - direction, spacing, edge routing, rank constraints, and the Diagram/Graph modes
  • Notations - the legend of a view
  • Organize - folders and order of views

Views are defined in views section. They can be named (must be unique) or unnamed (can’t be referenced, but still can be exported):

views {
// with name
view index {
}
// unnamed
view {
}
}

The view name is used as the image filename during export and as part of the URL when sharing, so it’s advisable to define one.

Views can have a title, description, tags, links, routing and order:

views {
view epic12 {
#next, #epic-12
title "Cloud System - Changes in Epic-12"
// Description can be Markdown with triple quotes
description """
This diagram shows the **high-level**
components and interactions.
"""
link https://my.jira/epic/12 'Epic-12'
// Draw relationships with right-angle bends
routing ortho
}
}

Properties must be defined before any predicates.

A view can be defined for a specific element (view of ...). The view will then inherit the scope of that element:

views {
view {
include api // ⛔️ Error: 'api' is not found
}
view of cloud.backend {
include api // ✅ This is OK, resolves to 'cloud.backend.api'
}
view of legacy {
include api // ✅ This is OK, resolves to 'legacy.api'
}
}

Additionally, a scoped view becomes the default for the element:

views {
view {
// on click navigates to 'view1',
// because it is default for 'cloud.backend'
include cloud.backend
}
view view1 of cloud.backend {
include *
}
}

You can define multiple views for the same element, with the default determined by their order.

Views can be extended to avoid duplication, to create a “baseline” or, for example, “slides” for a presentation:

views {
view view1 {
include *
}
view view2 extends view1 {
title 'Same as View1, but with more details'
// see Styles in views
style * {
color muted
}
include some.backend
}
// cascade inheritance
view view3 extends view2 {
title 'Same as View2, but with more details'
include * -> some.backend
}
}

The predicates and style rules of extended views are applied after the ones from ancestors.

Extended view also inherits the scope:

views {
view view1 of cloud.backend {
title 'Backend components'
}
view view2 extends view1 {
include api // ✅ This is OK, references 'cloud.backend.api'
}
}