Skip to content
D
Documentation

TextBlockOptions

reference
1 min readUpdated

Import it from @grafloria/renderer.

ts
interface TextBlockOptions

Properties

NameTypeDefaultDescription
textstringThe label text. Honors explicit '\n' as hard line breaks.
xnumberAnchor X in the local coordinate space of the returned .
ynumberAnchor Y in the local coordinate space of the returned .
maxWidth?numberWrap width. Omit / Infinity → no wrapping (one line unless '\n' present).
align?'start' | 'middle' | 'end'Horizontal text anchor. Default 'middle'.
valign?'top' | 'middle' | 'bottom'Vertical alignment of the whole block around y. Default 'middle'.
fontSize?numberFont size in px used for BOTH measurement and (optionally) emission.
fontFamily?string
fontWeight?number | stringFont weight, emitted only when defined.
color?stringFill color. Emitted only when defined (CSS-mode callers omit it).
className?string
clipId?stringWhen set, apply clip-path: url(#clipId) so overflow is hard-clipped.
maxLines?numberMax rendered lines; extra lines collapse into an ellipsis on the last.
lineHeight?numberLine-height multiplier. Default 1.2.
emitFontSize?booleanEmit the numeric fontSize as an attribute. Default true (CSS mode: false).
nonInteractive?booleanSet pointer-events: none (node labels don't intercept the mouse).

Was this page helpful?

TextBlockOptions — Grafloria