Skip to content

Classes and tables

Writing UML classes and database tables as compartments.

In a class diagram or an ER diagram, boxes are drawn as compartments: a header with the name, then rows. You write them as plain text. Double-click a box and edit its text; it resizes to fit as you type.

Classes

The first line is the class name. A line of dashes starts the next compartment, so attributes and methods sit in separate bands. An optional first line such as «interface» or <<abstract>> becomes the stereotype.

«interface»
Payable
---
+amount: number
---
+pay(): Receipt

Tables

The first line is the table name. Each following line is a column: its name, its type, then any of PK, FK, UNIQUE and NULL. Primary keys are shown in bold and every flag becomes a small badge.

orders
id  uuid  PK
customer_id  uuid  FK
placed_at  timestamp
note  text  NULL

The same text drives the canvas, SVG and PDF export, and Mermaid export, so what you see is what every format gets.

Related