Text¶
The Text component renders 2D text in 3D space using SDF (Signed Distance Field) rendering.
This is ideal for:
Creating labels and annotations
Building HUD elements
Displaying readable text from any distance
Adding captions to 3D objects
Basic Usage¶
A minimal example that creates 2D text in 3D space:
import asyncio
from vuer import Vuer
from vuer.schemas import DefaultScene, Text, OrbitControls
app = Vuer()
@app.spawn(start=True)
async def main(session):
session.set @ DefaultScene(
Text(
"Hello World!",
key="label",
color="green",
fontSize=0.15,
position=[0, 0.5, 0],
),
bgChildren=[
OrbitControls(key="OrbitControls")
],
)
while True:
await asyncio.sleep(1.0)
Key Parameters¶
Basic Parameters¶
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
str |
- |
Unique identifier for the text |
|
str |
- |
The text content to render |
|
str |
- |
Text color (hex or named color) |
|
float |
- |
Font size in world units |
|
list |
|
Text position in world coordinates |
|
list |
|
Text rotation (Euler angles) |
|
float |
|
Text scale multiplier |
Typography Parameters¶
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
str |
- |
Font URL or name |
|
int/str |
- |
Font weight (number or ‘bold’, ‘normal’, etc.) |
|
str |
- |
Font style: ‘italic’ or ‘normal’ |
|
str |
- |
Restrict character set for glyph generation |
Layout Parameters¶
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
float |
- |
Maximum width before text wrapping |
|
float |
- |
Line height as a multiple of fontSize |
|
float |
- |
Additional spacing between letters |
|
str |
- |
Text alignment: ‘left’, ‘right’, ‘center’, ‘justify’ |
|
float/str |
- |
Horizontal anchor: number or ‘left’, ‘center’, ‘right’ |
|
float/str |
- |
Vertical anchor: ‘top’, ‘top-baseline’, ‘middle’, ‘bottom-baseline’, ‘bottom’ |
|
str |
- |
Text direction: ‘auto’, ‘ltr’, or ‘rtl’ |
|
str |
- |
Wrapping behavior: ‘normal’ or ‘break-word’ |
|
str |
- |
White space handling: ‘normal’, ‘overflowWrap’, ‘nowrap’ |
Styling Parameters¶
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
float |
- |
Fill opacity (0-1) |
|
list |
- |
Clipping rectangle [minX, minY, maxX, maxY] |
|
float |
- |
Z-offset to avoid z-fighting |
Outline Parameters¶
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
float/str |
- |
Outline width (number or string like ‘2px’) |
|
float/str |
- |
Outline X offset |
|
float/str |
- |
Outline Y offset |
|
float/str |
- |
Outline blur radius |
|
str |
- |
Outline color |
|
float |
- |
Outline opacity (0-1) |
Stroke Parameters¶
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
float/str |
- |
Stroke width (number or string) |
|
str |
- |
Stroke color |
|
float |
- |
Stroke opacity (0-1) |
Advanced Parameters¶
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
int |
- |
SDF glyph size for rendering quality |
|
bool |
- |
Show SDF debug overlay |
|
int |
- |
Level of detail for glyph geometry |
Learn More¶
For detailed examples of using Text, see:
3D Text Tutorial - Complete text rendering guide