Skip to content
Weave templates

UML class diagram (compartments)

Class boxes built from a container + 3 stacked rect compartments (name / attrs / methods).

Template previewWeave
Rendering…

Make it your own.

{
  "nodes": [
    { "id":"c1","type":"container","label":"Order","x":40,"y":40,"width":240,"height":260,"fill":"rgba(219,234,254,0.4)","stroke":"#2563eb" },
    { "id":"c1a","type":"rect","label":"+id: UUID\n+createdAt: Date\n+total: Money","x":56,"y":120,"fill":"#ffffff","stroke":"#2563eb" },
    { "id":"c1m","type":"rect","label":"+place()\n+cancel()\n+refund()","x":56,"y":220,"fill":"#ffffff","stroke":"#2563eb" },
    { "id":"c2","type":"container","label":"LineItem","x":320,"y":40,"width":240,"height":260,"fill":"rgba(219,234,254,0.4)","stroke":"#2563eb" },
    { "id":"c2a","type":"rect","label":"+sku: String\n+qty: Int\n+unitPrice: Money","x":336,"y":120,"fill":"#ffffff","stroke":"#2563eb" },
    { "id":"c2m","type":"rect","label":"+subtotal()","x":336,"y":220,"fill":"#ffffff","stroke":"#2563eb" },
    { "id":"c3","type":"container","label":"Product","x":600,"y":40,"width":240,"height":260,"fill":"rgba(219,234,254,0.4)","stroke":"#2563eb" },
    { "id":"c3a","type":"rect","label":"+sku: String\n+title: String\n+list: Money","x":616,"y":120,"fill":"#ffffff","stroke":"#2563eb" },
    { "id":"c3m","type":"rect","label":"+priceFor(customer)","x":616,"y":220,"fill":"#ffffff","stroke":"#2563eb" },
    { "id":"c4","type":"container","label":"Customer","x":40,"y":360,"width":240,"height":200,"fill":"rgba(220,252,231,0.4)","stroke":"#15803d" },
    { "id":"c4a","type":"rect","label":"+id: UUID\n+email\n+name","x":56,"y":440,"fill":"#ffffff","stroke":"#15803d" },
    { "id":"c4m","type":"rect","label":"+placeOrder(items)","x":56,"y":520,"fill":"#ffffff","stroke":"#15803d" }
  ],
  "edges": [
    { "id":"e1","source":"c1","target":"c2","label":"1 — * has" },
    { "id":"e2","source":"c2","target":"c3","label":"* — 1 refers to" },
    { "id":"e3","source":"c4","target":"c1","label":"1 — * places" }
  ]
}