Skip to content

Text

@Composable



fun Text(
    text: Component, 
    fontScale: Float = 1.0f, 
    font: Font = Minecraft.getInstance().font, 
    color: Int = 0xFFFFFFFF.toInt(), 
    modifier: Modifier = Modifier
)

Renders a Component using Minecraft's font renderer.

Supports optional uniform scaling, a custom font face, and an ARGB text colour. The node automatically sizes itself to the minimum dimensions needed to display the text at the requested scale.

Example

Text(
    text = Component.literal("Hello, Archie!"),
    fontScale = 1.5f,
    color = KColor.YELLOW.argb,
)

Parameters

  • text: The text component to render.

  • fontScale: Uniform scale applied to the font. Default 1f (native size).

  • font: The Font used for rendering and size measurement.

  • color: ARGB packed text colour. Default opaque white (0xFFFFFFFF).

  • modifier: Additional modifiers applied to the layout node.