Skip to content

Text

The <Text> primitive places a text label at a given position. Control font size, weight, alignment, and color to add labels, titles, annotations, and axis markers to your scenes.

Te|
PropTypeDefaultDescription
xnumber0X coordinate of the text anchor point
ynumber0Y coordinate of the text baseline
contentstring (children)''The text to display
fillstring'currentColor'Text color
fontSizenumber16Font size in pixels
fontFamilystring'sans-serif'Font family
fontWeightstring | number'normal'Font weight (e.g. 'bold', 600)
textAnchor'start' | 'middle' | 'end''start'Horizontal alignment relative to x
opacitynumber1Opacity from 0 to 1
elements: {
title: {
id: 'title',
type: 'text',
role: 'title',
props: { type: 'text', x: 250, y: 80, content: 'Hello Elucim', fill: '$title', fontSize: 32, textAnchor: 'middle', fontWeight: 'bold' },
},
subtitle: {
id: 'subtitle',
type: 'text',
role: 'caption',
props: { type: 'text', x: 250, y: 140, content: 'Animate concepts. Illuminate understanding.', fill: '$muted', fontSize: 16, textAnchor: 'middle' },
},
}

Text remains a normal SVG layer. In a canonical timeline, a reveal effect with strategy: "type" reveals grapheme clusters and shows a cursor until the effect completes.

import { Reveal, Text, Timeline } from '@elucim/dsl/react';
<Text id="status" x={80} y={140} fontSize={28}>Deploying your workspace...</Text>
<Timeline id="intro" duration={60}>
<Reveal id="status-type" target="status" from={12} duration={48} strategy="type" cursor={{ character: '|' }} />
</Timeline>

Set cursor={false} to reveal text without a cursor. JSON/YAML documents represent the same authored effect in timelines.*.effects.