Skip to content

Paragraph

Long-form prose set as a book sets it: selectable text with explicit

<Paragraph ... />

Overview

leading, optional hyphenation, and an optional dropped initial that the following lines wrap around. Use Label for short text and UI copy.

Topics

Properties

Name Type Required Description
text string required The paragraph's text.
size number optional Body point size; defaults to 13.
design string optional default, serif, rounded or monospaced.
fontName string optional An OS-bundled face; falls back to design.
color string optional Semantic or hex text colour.
lineSpacing number optional Extra points between lines (SwiftUI lineSpacing).
alignment string optional leading, center, trailing or justified.
hyphenation boolean optional Hyphenates long words at line ends.
figure string optional Image beside the first lines, which wrap around it (as Zork Zero set a room's picture beside its description).
figureLines number optional Lines the square figure spans; defaults to 3.
revealedCharacters number optional Typewriter reveal: characters shown so far (as utf8.len counts them); -1, the default, shows all. Lines are those of the whole text, which takes its whole height however little is revealed.
links table optional Runs the reader can act on, from <Hyperlink> children: { location, length, label, items }, where location (from 0) and length count characters as utf8.len does and items are <MenuItem> records. A link is marked with a thicker dotted underline and opens its menu when tapped.
linkColor string optional Colour of the rule under links; defaults to the tint.

Example

<Paragraph text="Once upon a time…" design="serif" lineSpacing="5" figure="assets/hall.png" />

Platform notes

  • AppKit non-editable NSTextView (TextKit 1 exclusion paths). UIKit non-scrolling UITextView.

Source: lua/embedded/AppKit.lua:1075 (AppKit.Paragraph)