Refactored JSX elements from lowercase to PascalCase, including `<scene>` to `<Scene>`, `<text>` to `<Text>`, and others, to improve consistency and clarity in the codebase. Updated related documentation to reflect these changes, ensuring that the usage of JSX elements aligns with the new naming conventions. This update enhances the overall readability and usability of the JSX API.
1.4 KiB
1.4 KiB
<Text>
A text node; children become editable glyphs. Because the box defaults to the parent's box, a centered full-frame title is simply <Text textAlign="center" textBaseline="middle">…</Text>.
<Text fill="#FFFFFF" fontSize={128} fontWeight="bold" textAlign="center" textBaseline="middle">
Hello World
</Text>
Props
All common props, plus:
| Prop | Type | Default | Meaning |
|---|---|---|---|
| children | string (or expressions resolving to strings) |
required | The text content. |
fontFamily |
string |
editor default | A family available on the machine (dapi fonts). |
fontSize |
number |
editor default | Px. |
fontWeight |
number | "normal" | "bold" |
"normal" |
CSS weights 100-900. |
fontStyle |
"normal" | "italic" |
"normal" |
|
fill |
string |
white | The glyph color; any CSS color, alpha ignored (use opacity). Shorthand for a solid paint child (see paints.md); animate it by declaring the paint explicitly. |
textAlign |
"left" | "center" | "right" |
"left" |
Horizontal alignment of glyphs within the box. |
textBaseline |
"top" | "middle" | "bottom" |
"top" |
Vertical alignment within the box. |
The text-only animation types ("appearWord", "appearChar", "scramble") animate the glyphs themselves.