@mocanvas/mocanvas · interface

TextLabelProps

interface TextLabelProps

This one ships without a description. The signature above is read from the package, and the guides cover the area it belongs to.


Methods · 1

onChange(text: string): void

Called with the new text; at most once per animation frame while typing.


Properties · 18

align?: DefaultHorizontalAlignStyle

@deprecated v5 renamed this to textAlign.

color: string

CSS color of the text.

font?: DefaultFontStyle

@deprecated v5 renamed this to fontFamily.

fontFamily?: DefaultFontStyle

The label's font style token. Named font before v5; font is still accepted and means the same thing.

fontSize: number
height?: number
isEditing: boolean
onChangeRichText?(value: RichText): void

Called with the new rich-text document, at the same rate as onChange. A shape whose store prop is richText passes this; without it the label still edits, and only the plain text is written back.

padding?: number

Padding on every side of the text, in px (default 0).

placeholder?: string

Shown in place of an empty label when not editing.

richText?: RichTextSource

The label as a rich-text document, when the store holds one. A shape may carry either props.text or props.richText; both render here.

shape: UnknownShape
singleLine?: boolean

Single-line labels commit on Enter and never contain newlines (frame names).

text: string

The label as plain text. Ignored for rendering when TextLabelProps.richText is set; still the value the plain-text editing fallback starts from.

textAlign?: DefaultHorizontalAlignStyle

Horizontal alignment. Named align before v5; align is still accepted.

verticalAlign: DefaultVerticalAlignStyle
width?: number

Box the label is laid out in, in shape-local px. Omit for an intrinsically sized label.

wrap: boolean

Soft-wrap at width. When false the label only breaks at explicit newlines.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.