Skip to main content

Text

Text is a component that displays text in the world.

Syntax

<Text text={text} />

Parameters

All objects share the same base parameters from ComponentObjectProps.

NameTypeDescription
textstringThe text to display.
colorColorTypeThe color of the text.
fontSizenumberThe size of the font.
maxWidthnumberThe maximum width that the text can take up.
lineHeightnumberThe height of a line of text.
letterSpacingnumberThe space between each letter in the text.
textAligncenter, left, right, justifyThe alignment of the text.
fontstringThe font to use for the text.
anchorXnumber, center, left, rightThe X-axis anchor point for the text.
anchorYnumber, bottom, top, middle, top-baseline, bottom-baselineThe Y-axis anchor point for the text.
directionauto, ltr, rtlThe direction of the text.
overflowWrapnormal, break-wordHow to wrap the text when it overflows the container.
whiteSpacenormal, nowrap, overflowWrapHow to handle whitespace in the text.
outlineWidthstring, numberThe width of the text outline.
outlineOffsetXstring, numberThe X-axis offset of the text outline.
outlineOffsetYstring, numberThe Y-axis offset of the text outline.
outlineBlurstring, numberThe blur amount of the text outline.
outlineColorColorTypeThe color of the text outline.
outlineOpacitynumberThe opacity of the text outline.
strokeWidthstring, numberThe width of the text stroke.
strokeColorColorTypeThe color of the text stroke.
strokeOpacitynumberThe opacity of the text stroke.
fillOpacitynumberThe opacity of the text fill.
bloombooleanWhether use bloom effect.

Example

<Text
text="Hello World"
fontSize={0.5}
color="#d4d4d4"
outlineWidth={0.05}
outlineColor="#212121"
position={[0, 2, 0]}
/>

Available on: Client Server