Skip to content

Please add support multiline label to sql_table shape #2693

@KateFox1982

Description

@KateFox1982

Feature Request: Multiline Labels for sql_table Title

Summary

Enable multiline strings in the sql_table title/label.
This feature would improve readability and expressiveness when creating high-level data models, especially when using the new suspend / unsuspend functionality introduced in D2 v0.7.


Problem / Motivation

Currently, the sql_table title supports only a single-line label.
However, when building conceptual or logical data models, it is often necessary to include:

  • additional descriptions of the entity
  • business context
  • module or subsystem names
  • indicators of how/where the model was generated (e.g., via suspend)
  • metadata such as version, status, or classification

Without multiline labels in the table header, users must either clutter the diagram with separate comment nodes or omit important context.


Proposed Solution

Allow the sql_table title to accept multiline strings, for example:

sql_table Users {
  label: "Users\n(Conceptual Model)"
}

or using | strings:

sql_table Users {
  label: |
Users
(Conceptual Model)
  |
}

Expected behavior:

  • the table header expands vertically when multiline text is used
  • all lines are rendered inside the header cell
  • alignment remains consistent with existing themes
  • exports (SVG/PNG) preserve multiline formatting

Why This Should Be in Core

  • Enables more expressive and readable data models.
  • Matches expectations from ERD and data modeling tools.
  • Complements the new suspend/unsuspend features introduced in D2 v0.7.
  • Backwards-compatible and does not change current behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions