Skip to main content

Text Elements

TEXT elements render plain text or safe HTML into an image layer, then compose that layer into the video.

Interface

interface TextItem {
type: "TEXT";
text?: string;
html?: string;
style?: Record<string, string | number>;
x?: number;
y?: number;
width?: number;
height?: number;
anchor?: Anchor;
position?: PositionPreset;
enterBegin?: number;
enterEnd?: number;
exitBegin?: number;
exitEnd?: number;
track?: number;
opacity?: number;
angle?: number;
flipV?: boolean;
flipH?: boolean;
enterAnimation?: XFadeEffect | null;
exitAnimation?: XFadeEffect | null;
}

Required Fields

PropertyTypeNotes
type"TEXT"Case-insensitive in API validation.
text or htmlstringAt least one must contain content.

Common Property Reference

PropertyQuick notesFull reference
positionPreset placement such as center-center.PositionPreset
anchorTransform origin for placement and rotation.Anchor
animationsEnter and exit xfade effects.XFadeEffect

Content

  • text is plain text. The API rejects < and > in this field.
  • html supports a safe subset of inline HTML and takes priority over text when both are present.
  • style accepts safe CSS property names and safe string or number values.

Allowed html tags are b, strong, i, em, u, s, br, span, div, p, ul, ol, and li.

The API rejects script/style tags, event handler attributes, unsupported attributes, external CSS resource loads such as url(...) and @import, control characters, and unsafe CSS tokens.

Common Properties

PropertyDefaultNotes
x, y0Pixel position before preset positioning.
width, heightauto-calculatedUseful for multi-line text or fixed layouts.
positioncustomPreset positioning overrides x and y.
anchorderived from position when preset is usedTransform origin for placement and rotation.
enterBegin, enterEnd0Entrance timing.
exitBegin, exitEndproject.durationExit timing.
track0Higher tracks render above lower tracks.
opacity10 to 1.
angle0-360 to 360 degrees.
flipV, flipHfalseVertical and horizontal flips.

Examples

Plain Text

{
"type": "TEXT",
"text": "Hello World",
"x": 640,
"y": 360,
"anchor": "center-center",
"style": {
"fontSize": 48,
"color": "#000000",
"textAlign": "center"
}
}

Styled Text With Animation

{
"type": "TEXT",
"text": "Welcome to Zvid",
"position": "center-center",
"enterBegin": 0,
"enterEnd": 1,
"exitBegin": 9,
"exitEnd": 10,
"enterAnimation": "fade",
"exitAnimation": "fade",
"style": {
"fontSize": 36,
"color": "#ff6b35",
"textAlign": "center",
"fontWeight": "bold"
}
}

Safe HTML

{
"type": "TEXT",
"html": "<div style=\"text-align:center\"><p style=\"color:#ff6b35; margin:0; font-size:48px\">Big Title</p><p style=\"color:#666666; font-size:18px\">Subtitle text</p></div>",
"position": "center-center",
"enterBegin": 0,
"enterEnd": 2,
"exitBegin": 8,
"exitEnd": 10
}

Watermark

{
"type": "TEXT",
"text": "WATERMARK",
"x": 660,
"y": 340,
"anchor": "center-center",
"angle": 45,
"opacity": 0.3,
"track": 10,
"style": {
"fontSize": 72,
"color": "#000000",
"fontFamily": "Anton",
"textAlign": "center"
}
}

Font Handling

Use exact Google Fonts family names, such as Poppins, Montserrat, Roboto, Open Sans, Lato, Playfair Display, Oswald, or Bebas Neue.