Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Collections

  • QuestionCard
  • Table
  • Book3D
  • ProTable
  • PricingTable
  • JsonViewer
  • EditableTable
  • List
  • Descriptions
  • RowActions
  • Tree
  • Card
  • Carousel
  • Video
  • Audio
  • BentoGrid
  • Image
  • MagicCard
  • AnimatedList
  • Marquee
  • Sortable
  • Kanban
  • DesignCanvas
  • LayerTree
  • StageDraw
  • SlideDeck
  • PresenterView
  • ComponentPicker
  • EventStream
  • QueueLane
  • DocumentSheet
  • Novel reader
  • Scheduler
  • Org classroom
  • Danmaku
  • LiveChat
  • LivePlayer
  • LogViewer
  • FileTree
  • CodeReviewThread
  • VirtualList
  • InfiniteScroll
  • LogoLoop
  • BounceCards
  • CardSwap
  • ChromaGrid
  • CircularGallery
  • DomeGallery
  • FlyingPosters
  • InfiniteMenu
  • MagicBento
  • ScrollStack
  • ProfileCard
  • TiltedCard
  • PixelCard
  • DecayCard
  • ReflectiveCard
  • Folder

Charts and Diagrams

  • Flow
  • Diagram
  • Paper
  • SequenceDiagram
  • Sankey
  • Sparkline
  • Funnel
  • Treemap
  • Gantt
  • Heatmap
  • ContributionGraph
  • Legend
  • Chart
  • WorldMap

Information

  • ImageViewer
  • LiveProductCard
  • DiffStat
  • ScoreRing
  • ScoreScale
  • Badge
  • Dot
  • StatusDot
  • Chip
  • FilterChip
  • Coupon
  • Tag
  • Annotation
  • Avatar
  • AvatarCircles
  • User
  • QRCode
  • Comment
  • RelativeTime
  • GitCommit
  • DeployStatus
  • ShieldBadge
  • AwardBadge
  • CreditCard
  • IconTile

Metrics

  • Stat
  • Statistic
  • Meter
  • Timeline
  • NumberTicker

Placeholders

  • Empty
  • Skeleton
  • Watermark

Diagram

diagram

Renders 54 editorial declarative SVG diagram types with orthogonal routing, 4 importers (Mermaid/draw.io/Excalidraw/PlantUML), and Paper/Markdown integrations.

Usage

54 Editorial Diagrams Gallery & Multi-Format Importers

Browse all 54 visual types across 6 layout families, explore 9 semantic patterns, and redraw Mermaid, draw.io, Excalidraw, or PlantUML live into editorial SVG.

Components + connections + nested trust/traffic zonesarchitecture · ≤9
ARCHITECTURE · HULIAN
Edge SSR & Content Architecture
Edge SSR & Content ArchitectureEdge SSR & Content Architecture diagram showing structured components and relationships.CONTENTHTTPSRESPSSRREAD MDXQUERYEXTReaderBrowser01EDGECloudflarePages · cache02ORIGAstro OriginSSR + MDXBUNMDX Bundlesrc/content/*.mdxCMSContent CMSassets · og imagesLEGENDFocal / originBackend / bundleStoreExternalHTTP requestPrimary flowReturn / async
tsx
import { Diagram, importDiagram } from "@hulianui/ui/diagram";

export function ArchitectureCard() {
  return (
    <Diagram
      spec={{
        type: "architecture",
        title: "Payment Core Topology",
        skin: "editorial",
        variant: "dots",
        nodes: [
          { id: "gw", label: "API Gateway", tag: "EDGE", icon: "gateway" },
          { id: "ledger", label: "Ledger Core", tag: "CORE", treatment: "focal", icon: "database" },
        ],
        edges: [{ from: "gw", to: "ledger", label: "COMMIT", tone: "accent" }],
      }}
    />
  );
}

With Paper (Dynamic Figures & Print Adaptation)

Drive highlightNodes from prose FigRef clicks inside PaperFigure; switching to print mode adapts automatically to light paper and expands sub-figures.

in the system overview, external traffic passes through the gateway and auth guard before entering synchronous ledger persistence. Switching to print mode adapts the diagram to light paper and expands sub-figures.

Transaction PipelineTransaction Pipeline diagram showing structured components and relationships.VERIFYCOMMITEDGEAPI GatewayTLS 1.3SECPolicy GuardRBAC + mTLSSTORELedger StoreSync WAL
Figure : Core transaction pipeline with narrative focus
tsx
import { FigRef, Paper, PaperFigure } from "@hulianui/ui";
import { ArchitectureDiagram } from "@hulianui/ui/diagram";

const states = {
  overview: { focus: [] as string[] },
  ingress: { focus: ["gw", "auth"] },
  commit: { focus: ["auth", "ledger"] },
};

export function PaperLinkedDiagram() {
  return (
    <Paper defaultMode="read">
      <p>
        Click <FigRef to="tx-arch" state="ingress">Gateway & Auth Guard</FigRef> to highlight the active nodes.
      </p>
      <PaperFigure id="tx-arch" states={states} caption="Core transaction pipeline with narrative focus">
        {(state) => (
          <ArchitectureDiagram
            title="Transaction Pipeline"
            showHeader={false}
            highlightNodes={state.focus}
            nodes={[
              { id: "gw", label: "API Gateway", tag: "EDGE" },
              { id: "auth", label: "Policy Guard", tag: "SEC", treatment: "security" },
              { id: "ledger", label: "Ledger Store", tag: "STORE", treatment: "focal" },
            ]}
            edges={[
              { from: "gw", to: "auth", label: "VERIFY" },
              { from: "auth", to: "ledger", label: "COMMIT", tone: "accent" },
            ]}
          />
        )}
      </PaperFigure>
    </Paper>
  );
}

With Markdown (Automatic Fenced Diagram Rendering)

Pass createMarkdownDiagramRenderer to Markdown.renderCodeBlock to redraw mermaid, plantuml, drawio, excalidraw, and diagram fences automatically.

Embedded Diagrams in Markdown

Write fenced mermaid blocks directly in Markdown and let createMarkdownDiagramRenderer() redraw them in Hulian editorial style:

FLOWCHART · SHAPE CARRIES TYPE
Mermaid Diagram
Mermaid DiagramMermaid Diagram diagram showing structured components and relationships.HTTPSGRPCSQLWeb ClientAPI EdgeOrder CorePostgres

Regular language fences fall back to the default CodeBlock:

ts
const renderCodeBlock = createMarkdownDiagramRenderer({ skin: "editorial" });
tsx
import { Markdown } from "@hulianui/ui";
import { createMarkdownDiagramRenderer } from "@hulianui/ui/diagram";

const renderCodeBlock = createMarkdownDiagramRenderer({
  skin: "editorial",
  variant: "dots",
});

export function TechnicalDoc({ source }: { source: string }) {
  return <Markdown renderCodeBlock={renderCodeBlock}>{source}</Markdown>;
}

With SlideDeck / StageDraw (Stepped Walkthrough & Live Ink)

Sync controlled activeStep with slide progression and overlay StageDraw for live presentation annotations.

SLIDEDECK · STAGEDRAW
Slide Step Walkthrough
Slide Step WalkthroughSlide Step Walkthrough diagram showing structured components and relationships.STREAMARCHIVEINPUTEvent IngestCORERule EngineSTOREAudit Sink
tsx
import { useState } from "react";
import { StageDraw } from "@hulianui/ui";
import { ArchitectureDiagram } from "@hulianui/ui/diagram";

export function PresentationDiagram() {
  const [step, setStep] = useState<number | null>(1);
  return (
    <div className="relative">
      <ArchitectureDiagram
        title="Slide Step Walkthrough"
        activeStep={step}
        onActiveStepChange={setStep}
        nodes={[
          { id: "ingest", label: "Event Ingest", step: 0 },
          { id: "router", label: "Rule Engine", treatment: "focal", step: 1 },
          { id: "sink", label: "Audit Sink", treatment: "store", step: 2 },
        ]}
        edges={[
          { from: "ingest", to: "router", label: "STREAM", step: 1 },
          { from: "router", to: "sink", label: "ARCHIVE", tone: "accent", step: 2 },
        ]}
      />
      <StageDraw tool="pen" toolbar />
    </div>
  );
}

When to use

Built for technical documentation, architecture decision records (ADRs), blogs, papers, slides, and structured AI generation. Pass a typed JSON spec (or Mermaid / draw.io / Excalidraw / PlantUML source) to render publication-grade editorial SVG with 4px-grid rounded orthogonal routing, OKLCH zero-flash theme adaptation, geometry verification, and offline-safe SVG/PNG export.

How it fits into the Hulian visualization ecosystem:

  • Interactive dashboards & business apps (hover tooltips, drill-down, drag-and-drop editing): use Chart, Sankey, Funnel, Treemap, Gantt, Heatmap, SequenceDiagram, or Flow.
  • Editorial concept & architecture diagrams for docs, papers, slides, and AI output: use Diagram (@hulianui/ui/diagram).
  • Dynamic narrative & presentation stages: place <Diagram> inside Paper (PaperFigure + FigRef) to highlight nodes from prose and adapt cleanly to print; pair with SlideDeck / StageDraw for stepped walkthroughs with live ink annotations; or wire createMarkdownDiagramRenderer() into Markdown to redraw fenced mermaid blocks automatically.

Import

Like Formula, Diagram lives on its own subpath so consumers who do not render diagrams pay zero bundle cost—and no extra npm package installation is required beyond @hulianui/ui:

ts
import {
  Diagram,
  ArchitectureDiagram,
  DIAGRAM_CATALOG,
  SEMANTIC_PATTERN_CATALOG,
  createMarkdownDiagramRenderer,
  importDiagram,
  exportDiagramToSvgString,
  verifyDiagramSvg,
} from "@hulianui/ui/diagram";

Fine-grained subpaths are also available: @hulianui/ui/diagram/importers, @hulianui/ui/diagram/export, @hulianui/ui/diagram/verify, and @hulianui/ui/diagram/catalog.

54 visual types across 6 layout families

Layout familyCountVisual types
Graph & Zone (graph-zone)17architecture, architecture-delta, it-current-state, deployment, high-level, data-flow, dp-integration, medallion, flowchart, state-machine, swimlane, process, procedure-chart, event-modeling, dependency-graph, schedule-network, sbgn
Hierarchy & Schema (hierarchy)8tree, org-chart, nested, layer-stack, er, database-schema, uml-class, git-graph
Matrix & Blueprint (matrix)7quadrant, wardley-map, user-journey, service-blueprint, story-map, dp-security-matrix, requirement-traceability
Analytical & Geometric (analytical)14bar, line, radar, waterfall, scatter, polar, unit-grid, venn, loop, fishbone, packet-structure, heatmap, treemap, pyramid
Flow & Time (flow-time)6sequence, gantt, sankey, kanban, timeline, steps
Axonometric (axonometric)2exploded-axonometric, axonometric-plan

Common props (DiagramCommonProps)

NameTypeDefaultDescription
title *string-Diagram title shown in header and written into SVG <title>
eyebrowstringDerived from typeMonospace eyebrow label above the title
descriptionstringAuto-generatedWritten into SVG <desc> for screen readers and verification
skin"editorial" | "light" | "dark" | "terminal""editorial"Defaults to @hulianui/tokens OKLCH semantic tokens with zero-flash dark mode
variant"clean" | "dots" | "sketchy""clean"Paper surface treatment: clean paper, dot grid, or subtle hand-drawn filter
motion"none" | "reveal" | "step" | "loop""none"Optional step walkthrough controls, respecting prefers-reduced-motion
activeStepnumber | null-Controlled 0-based step index (null shows all), for syncing with Paper or SlideDeck
defaultActiveStepnumber | nullnullUncontrolled initial step index
onActiveStepChange(step: number | null) => void-Callback when the active step changes
highlightNodesreadonly string[]-Node IDs to emphasize (ideal for <FigRef> narrative focus)
highlightEdgesreadonly string[]-Edge IDs or "from->to" keys to emphasize
dimOthersbooleantrueDim non-highlighted elements when focus arrays are provided
adaptPaperPrintbooleantrueAutomatically switches editorial to light paper and hides step controls when inside <Paper mode="print">
sizePresetDiagramSizePreset"fit"Canvas aspect presets (doc-inline, doc-wide, slide-16x9, print-a4-landscape, etc.)
showHeaderbooleantrueSet to false when nested inside a captioned container like PaperFigure
legend / callouts / summaryCardsarrays-Bottom horizontal legend, editorial italic callouts, and asymmetric summary cards

Ecosystem integrations

1. With Paper

Place <Diagram> inside <PaperFigure> and drive highlightNodes or activeStep from prose <FigRef> clicks. When <Paper> switches to print mode, Diagram reads PaperContext automatically, adapts to light paper, and hides interactive step buttons.

2. With Markdown

Pass createMarkdownDiagramRenderer(options?) to <Markdown renderCodeBlock={...} />:

  • Automatically renders mermaid, plantuml / puml, drawio, excalidraw, and diagram (JSON DiagramSpec) fenced blocks in Hulian editorial style.
  • Gracefully falls back to the default CodeBlock for all other languages or invalid input.

3. Shared offline SVG / PNG export

exportDiagramToSvgString(svg) shares the OKLCH-to-sRGB color resolver from Paper, turning var(--color-*) and oklch() / oklab() values into standalone #rrggbb + opacity attributes so exported SVGs open reliably offline in Word, Inkscape, and LaTeX.

Playground

ARCHITECTURE · HULIAN
Payment Core Topology
ALL
Payment Core TopologyPayment Core Topology diagram showing structured components and relationships.REQUESTDISPATCHCOMMITUIWeb ClientHTTPSEDGEAPI GatewayTLS 1.3CORELedger CoregRPCSTOREPostgresSync WAL
<ArchitectureDiagram title="Payment Core Topology" skin="editorial" variant="dots" motion="step" showHeader={true} nodes={nodes} edges={edges} />
PreviousFlowData DisplayNextPaper

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • 54 visual types across 6 layout families
    • Common props (DiagramCommonProps)
    • Ecosystem integrations
  • Playground