Skip to content

Component Diagram

c4.diagrams.component.ComponentDiagram

Bases: Diagram

Represents a C4 Component diagram.

c4.diagrams.component.Component

Bases: Element

Represents a software component within a container.

A component is a logical unit (such as a class, module, or handler) that performs a specific function within a container. Includes metadata like technology, visual style, and links.

__init__

__init__(
    label: str | Required = not_provided,
    description: str = "",
    technology: str = "",
    sprite: str = "",
    tags: str = "",
    link: str = "",
    base_shape: str = "",
    alias: str | EmptyStr = empty,
) -> None

Parameters:

Name Type Description Default
label str | Required

Human-readable name of the component.

not_provided
description str

Optional description of the component's behavior or role.

''
technology str

Technology used to implement the component.

''
sprite str

Optional sprite for visual appearance in the diagram.

''
tags str

Comma-separated tags for filtering or styling.

''
link str

Optional external link related to the component.

''
base_shape str

Optional shape override for rendering.

''
alias str | EmptyStr

Unique identifier for the component.

empty

c4.diagrams.component.ComponentDb

Bases: ElementWithTechnology

Represents a component modeled as a database.

Used to depict data storage components in a component diagram.

c4.diagrams.component.ComponentQueue

Bases: ElementWithTechnology

Represents a component modeled as a message queue.

Useful for showing message-based or asynchronous communication paths.

c4.diagrams.component.ComponentExt

Bases: Component

Represents an external component outside the container boundary.

Commonly used to show third-party libraries or external system components.

c4.diagrams.component.ComponentDbExt

Bases: ComponentDb

Represents an external database component.

Used for visualizing data stores not maintained by the system.

c4.diagrams.component.ComponentQueueExt

Bases: ComponentQueue

Represents an external message queue or broker.

Used to show external infrastructure for asynchronous communication.