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.
- Domaine
- Affichage de données
- Niveau de support
- Taille
- 4.6 kB gzip, budget 3.5 kB
- Qui l'utilise
- 2 fichiers des produits et sites en production l'importent Compté dans l'inventaire daté du 2026-11-23.
import { ArchitectureDiagram } from "@krizaka/ui/architecture-diagram";Web uniquement — React, depuis @krizaka/ui/architecture-diagram. Expérimental : créé pour un besoin déposé, il peut changer ou disparaître à toute version mineure, jusqu'à ce qu'une première app l'utilise.
- Mobile · n/a. A figure of a reading page (a post, a docs site); an app screen lists the same elements and relations. → List
Pourquoi il est là. 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).
Quand l’utiliser
- 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.
Quand ne pas l’utiliser
- An engine and the apps it serves, with what travels between them, on a landing.À la place : Engine flow
- A sequence of steps a person goes through.À la place : Stepper
- Facts about one element.À la place : Description list
Installation
Installer
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Importer
import { ArchitectureDiagram } from "@krizaka/ui/architecture-diagram";Exemples
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 | Défaut | Description |
|---|---|---|---|
viewrequis | 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. |
Accessibilité
- 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.
Clavier
| Touches | Action |
|---|---|
| Arrow keys | Scroll the drawing in its frame (once the frame has focus) when it is wider than the screen. |
Bonnes pratiques
- 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.
Composants liés
Générée depuis le code de @krizaka/ui 5.3.4 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub