LikeC4 Views¶
Views are created on project.views. See the views guide.
c4.contrib.likec4.Views ¶
The views of a project in declaration order.
Attributes:
| Name | Type | Description |
|---|---|---|
all |
list[ElementView | DeploymentView | DynamicView]
|
Every view in creation order, whatever its type. |
element_view ¶
element_view(
key: str, title: str | None = None, **kwargs: Any
) -> ElementView
Create an element view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
View key. |
required |
title
|
str | None
|
Optional title. |
None
|
**kwargs
|
Any
|
|
{}
|
deployment_view ¶
deployment_view(
key: str, title: str | None = None, **kwargs: Any
) -> DeploymentView
Create a deployment view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
View key. |
required |
title
|
str | None
|
Optional title. |
None
|
**kwargs
|
Any
|
|
{}
|
dynamic_view ¶
dynamic_view(
key: str, title: str | None = None, **kwargs: Any
) -> DynamicView
Create a dynamic view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
View key. |
required |
title
|
str | None
|
Optional title. |
None
|
**kwargs
|
Any
|
|
{}
|
c4.contrib.likec4.ElementView ¶
Bases: _PredicateView
A view over model elements.
Attributes:
| Name | Type | Description |
|---|---|---|
key |
Unique view key. |
|
title |
Optional title. |
|
description |
Optional Markdown description. |
|
scope |
Element the view is |
|
tags |
View tags, without |
|
links |
tuple[Link, ...]
|
Hyperlinks. |
rules |
list[Any]
|
Include, exclude, style and autoLayout rules in the order they were added. |
auto_layout ¶
auto_layout(
direction: str = "TopBottom",
rank_sep: int | None = None,
node_sep: int | None = None,
) -> Self
Add an autoLayout rule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
direction
|
str
|
|
'TopBottom'
|
rank_sep
|
int | None
|
Optional spacing between ranks. |
None
|
node_sep
|
int | None
|
Optional spacing between nodes; needs |
None
|
include ¶
include(
*items: Any, navigate_to: str | None = None
) -> Self
Add an include rule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*items
|
Any
|
Elements, |
()
|
navigate_to
|
str | None
|
Key of the view to open on click. |
None
|
exclude ¶
exclude(*items: Any) -> Self
Add an exclude rule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*items
|
Any
|
Same kinds of item as |
()
|
style ¶
style(*targets: Any, **properties: Any) -> Self
Add a style rule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*targets
|
Any
|
Items to style. |
()
|
**properties
|
Any
|
Element style properties. |
{}
|
c4.contrib.likec4.DeploymentView ¶
Bases: _PredicateView
A view over deployment nodes and instances.
include takes no navigate_to: with overrides are not emitted
in deployment views.
auto_layout ¶
auto_layout(
direction: str = "TopBottom",
rank_sep: int | None = None,
node_sep: int | None = None,
) -> Self
Add an autoLayout rule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
direction
|
str
|
|
'TopBottom'
|
rank_sep
|
int | None
|
Optional spacing between ranks. |
None
|
node_sep
|
int | None
|
Optional spacing between nodes; needs |
None
|
exclude ¶
exclude(*items: Any) -> Self
Add an exclude rule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*items
|
Any
|
Same kinds of item as |
()
|
style ¶
style(*targets: Any, **properties: Any) -> Self
Add a style rule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*targets
|
Any
|
Items to style. |
()
|
**properties
|
Any
|
Element style properties. |
{}
|
include ¶
include(*items: Any) -> Self
Add an include rule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*items
|
Any
|
Deployment nodes or instances, |
()
|
c4.contrib.likec4.DynamicView ¶
Bases: _View
A dynamic view: an ordered, flat list of steps.
The steps live in a list of immutable nodes so that block nodes can be added later without changing the flat-step API.
Attributes:
| Name | Type | Description |
|---|---|---|
key |
Unique view key. |
|
title |
Optional title. |
|
description |
Optional Markdown description. |
|
variant |
DynamicVariant
|
|
auto_layout ¶
auto_layout(
direction: str = "TopBottom",
rank_sep: int | None = None,
node_sep: int | None = None,
) -> Self
Add an autoLayout rule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
direction
|
str
|
|
'TopBottom'
|
rank_sep
|
int | None
|
Optional spacing between ranks. |
None
|
node_sep
|
int | None
|
Optional spacing between nodes; needs |
None
|
step ¶
back ¶
c4.contrib.likec4.DynamicStep
dataclass
¶
One interaction of a dynamic view.
Attributes:
| Name | Type | Description |
|---|---|---|
source |
Element
|
Element that appears on the left of the arrow. |
target |
Element
|
Element that appears on the right of the arrow. |
title |
str | None
|
Step label. |
description |
str | None
|
Longer Markdown description. |
technology |
str | None
|
Technology of the interaction. |
notes |
str | None
|
Markdown notes. |
navigate_to |
str | None
|
Key of a dynamic view to open on click. |
color |
str | None
|
Theme or custom color name. |
backward |
bool
|
|
c4.contrib.likec4.Wildcard
dataclass
¶
The * predicate: the scope of a view or all top-level elements.
c4.contrib.likec4.Children
dataclass
¶
The direct children of element (element.*).
c4.contrib.likec4.Descendants
dataclass
¶
All nested elements of element (element.**).
c4.contrib.likec4.Rel ¶
Rel(
title: str | None = None,
*,
description: str | None = None,
technology: str | None = None,
kind: str | None = None,
bidirectional: bool = False,
tags: list[str] | tuple[str, ...] | None = None,
metadata: Mapping[str, Any] | None = None,
links: list[Any] | tuple[Any, ...] | None = None,
navigate_to: str | None = None,
**style: Any,
) -> _RelExpression
Start a relationship expression: a >> Rel("calls") >> b.
Only title may be positional; pass the other options by name. The
expression is immutable and can be reused.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str | None
|
Relationship label. |
None
|
description
|
str | None
|
Longer Markdown description. |
None
|
technology
|
str | None
|
Technology used by the relationship. |
None
|
kind
|
str | None
|
Declared relationship kind. |
None
|
bidirectional
|
bool
|
Declare the relationship with |
False
|
tags
|
list[str] | tuple[str, ...] | None
|
Tags applied to the relationship, without |
None
|
metadata
|
Mapping[str, Any] | None
|
Custom metadata. |
None
|
links
|
list[Any] | tuple[Any, ...] | None
|
Hyperlinks. |
None
|
navigate_to
|
str | None
|
Key of the dynamic view to open on click. |
None
|
**style
|
Any
|
Relationship-local style properties. |
{}
|
c4.contrib.likec4.Where
dataclass
¶
item where tag is #tag and kind is kind filter over another item.
Attributes:
| Name | Type | Description |
|---|---|---|
item |
Any
|
Element, |
tag |
str | None
|
Tag name written without |
kind |
str | None
|
Element kind name. |
c4.contrib.likec4.RawPredicate
dataclass
¶
Predicate text emitted verbatim; the renderer cannot check it.