Skip to content

Views

LikeC4 is model-based, and views are projections of the model from various perspectives, scopes, and levels of detail, such as:

  • System/service overviews
  • Component interactions in specific use cases
  • Data flows and sequence diagrams

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.

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’s name is used as an 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 and links:

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'
}
}

Properties must be defined before 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'
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 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'
}
}