Architecture diagram
One laid-out C4 view (context, containers, components or a dynamic flow) drawn on the plate in the page's tokens — groups, elements by shape, labelled edges, numbered steps — with its full text version.
- Domain
- Data display
- Support level
- Size
- 4.6 kB gzip, budget 3.5 kB
- Who uses it
- 2 files of the live products and sites import it Counted in the dated inventory of 2026-11-23.
import { ArchitectureDiagram } from "@krizaka/ui/architecture-diagram";Web only — React, from @krizaka/ui/architecture-diagram. Experimental: created for a filed need, it may change or go in any minor version, until its first app uses it.
- Mobile · n/a. A figure of a reading page (a post, a docs site); an app screen lists the same elements and relations. → List
Why it is here. krizaka-blog draws its C4 views with it and drops its own renderer (krizaka/krizaka-blog#340); then the docs sites of @krizaka/docs and the cockpit (krizaka-internal#3672).
When to use
- A post or a docs page that shows how a system is built: its context, its containers, its components.
- A dynamic view: the numbered steps of one flow (a request, a release, a pull request's life).
- A cockpit page that shows the architecture the code was checked against.
When not to use
- An engine and the apps it serves, with what travels between them, on a landing.Use instead: Engine flow
- A sequence of steps a person goes through.Use instead: Stepper
- Facts about one element.Use instead: Description list
Installation
Install
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Import
import { ArchitectureDiagram } from "@krizaka/ui/architecture-diagram";Examples
Context
Who uses the system and what it relies on outside: a person, a browser, an external store.
Containers
The system as a group, its containers inside, a database below.
Dynamic flow
dynamic: true: the edges are numbered steps, and the text version lists them in order.
Props
One laid-out C4 view (context, containers, components, or a dynamic flow) drawn on the plate: groups, elements by shape, edges with their labels and, in a dynamic view, numbered steps. The full text version follows it.
| Prop | Type | Default | Description |
|---|---|---|---|
viewrequired | ArchView | — | One laid-out view, as @krizaka/architecture emits it: the component draws it and lays out nothing. |
links | Readonly<Record<string, string>> | — | Links of the elements, by node id: each title of the text version becomes a link. Only http:/https: addresses
and same-site paths are kept (safeHref); any other is dropped and the title stays plain text. |
subtitle | ReactNode | — | One line beside the title: the view's scope, its source. |
textOpen | boolean | false | Opens the text version from the start (a page where the words are the main reading). |
title | string | view.title | The figure's title, shown above the drawing and read as the image's name. |
words | Partial<ArchitectureDiagramWords> | — | The words of the text version. |
Accessibility
- The drawing is one image (
role="img") named by the view's title (aria-label); its text version is a<details>built from the same view: the elements (nested in their groups), then the relations or, in a dynamic view, the ordered steps. - Every label is a text child, never markup: a hostile title renders as its characters.
- A link is only an
http:/https:address, a same-site path or an anchor (safeHref); any other scheme is dropped. - On a phone the drawing keeps a legible size and scrolls in its frame, which takes the keyboard focus; the text version is the phone reading.
Keyboard
| Keys | Action |
|---|---|
| Arrow keys | Scroll the drawing in its frame (once the frame has focus) when it is wider than the screen. |
Best practices
- Pass the view
@krizaka/architecturelaid out, unchanged: the component draws, it never lays out, so the drawing is the model's. - One view per figure, under its view title; the
subtitlesays the level (C4 · level 2) or the source. - Pass
linksby element id for the elements that have a page: they become links in the text version. - Pass
wordsin the page's language: the text version's headings are props.
Related components
Generated from the code of @krizaka/ui 5.3.4: its meta.ts, its examples and its types.Edit this documentation on GitHub