Skip to content

vyaz-monorepo / core/src / TextRun

Interface: TextRun

Defined in: core/src/types/Document.ts:256

A single inline run of styled text.

This replaces the earlier TextRunNode + TextStyleNode pair; all style properties are flattened directly onto the run.

Each run represents a continuous piece of text with uniform styling. Consecutive runs with different styles are split by the input parser.

Example

ts
{ text: "Hello", fontFamily: "Arial", fontSize: 16, fontWeight: "bold", color: "#000" }

Properties

backgroundColor?

optional backgroundColor?: string

Defined in: core/src/types/Document.ts:290

Background color (optional).


color

color: string

Defined in: core/src/types/Document.ts:288

Text color in any CSS-compatible format (hex, rgb, named).


data?

optional data?: Record<string, string>

Defined in: core/src/types/Document.ts:331

Free-form metadata for features the layout engine itself never interprets — e.g. @vyaz/converters carrying an <a>'s href through to @vyaz/renderer, which wraps the run's painted output in <a href="…"> for the browser/preserve presets. A key's meaning is a contract between whichever writer sets it and whichever reader consumes it; layout treats this purely as opaque pass-through (no effect on measurement, wrapping, or positioning). Modelled on unist's data node field (the remark/rehype AST spec) for the same reason: keep the base type lean instead of growing a named field per cross-cutting feature.


fontFamily

fontFamily: string | string[]

Defined in: core/src/types/Document.ts:280

Font family name, or a CSS-style fallback list tried in order (e.g. "Arial" or ["Inter", "Arial", "sans-serif"]). The layout result always reports the concrete family that was used; see LayoutOptions.onMissingFont.


fontSize

fontSize: number

Defined in: core/src/types/Document.ts:282

Font size in px.


fontStyle

fontStyle: "normal" | "italic"

Defined in: core/src/types/Document.ts:286

Font style.


fontWeight

fontWeight: number | "normal" | "bold"

Defined in: core/src/types/Document.ts:284

Font weight: 'normal', 'bold', or a numeric CSS weight (100–900).


fullSizeKana?

optional fullSizeKana?: boolean

Defined in: core/src/types/Document.ts:316

Experimental

Convert small kana to full-size kana. Accepted in the type but ignored by the layout engine (no-op until implemented).


fullWidth?

optional fullWidth?: boolean

Defined in: core/src/types/Document.ts:314

Experimental

Force full-width characters (CJK). Accepted in the type but ignored by the layout engine (no-op until implemented).


inlineWidget?

optional inlineWidget?: InlineWidget

Defined in: core/src/types/Document.ts:270

Inline widget data (only when type === 'inline-box'). Represents an embedded object (image, icon, etc.) that sits inside the text flow.


letterSpacing?

optional letterSpacing?: number

Defined in: core/src/types/Document.ts:292

Letter-spacing (tracking) in px. 0 means default.


overline?

optional overline?: boolean

Defined in: core/src/types/Document.ts:303

Experimental

Overline decoration. Accepted in the type but ignored by the layout engine (no-op until implemented).


script?

optional script?: ScriptType

Defined in: core/src/types/Document.ts:294

Subscript / superscript override.


strikethrough?

optional strikethrough?: boolean

Defined in: core/src/types/Document.ts:301

Strikethrough decoration.


text

text: string

Defined in: core/src/types/Document.ts:264

The text content of this run (or \uFFFC for inline-box).


textDecorationColor?

optional textDecorationColor?: string

Defined in: core/src/types/Document.ts:307

Experimental

Underline / overline / strikethrough line color. Accepted in the type but ignored by the layout engine (no-op until implemented).


textDecorationStyle?

optional textDecorationStyle?: TextDecorationStyle

Defined in: core/src/types/Document.ts:305

Experimental

Underline / overline / strikethrough line style. Accepted in the type but ignored by the layout engine (no-op until implemented).


textTransform?

optional textTransform?: TextTransform

Defined in: core/src/types/Document.ts:312

Case transform (uppercase, lowercase, capitalize).


type

type: "text" | "inline-box"

Defined in: core/src/types/Document.ts:262

Run kind:

  • 'text' — plain text (the most common case).
  • 'inline-box' — an inline widget placeholder (\uFFFC).

underline?

optional underline?: boolean

Defined in: core/src/types/Document.ts:299

Underline decoration.

Released under the MIT License.