RemoteBasicText

Functions summary

Unit
@Composable
@RemoteComposable
RemoteBasicText(
    text: RemoteString,
    modifier: RemoteModifier,
    color: RemoteColor?,
    fontSize: RemoteTextUnit?,
    fontStyle: RemoteFontStyle?,
    fontWeight: RemoteFontWeight?,
    fontFamily: RemoteFontFamily?,
    textAlign: RemoteTextAlign?,
    overflow: RemoteTextOverflow,
    maxLines: Int,
    fontVariationSettings: RemoteFontVariation.Settings?,
    style: RemoteTextStyle
)

Displays text in a remote layout.

Functions

@Composable
@RemoteComposable
fun RemoteBasicText(
    text: RemoteString,
    modifier: RemoteModifier = RemoteModifier,
    color: RemoteColor? = null,
    fontSize: RemoteTextUnit? = null,
    fontStyle: RemoteFontStyle? = null,
    fontWeight: RemoteFontWeight? = null,
    fontFamily: RemoteFontFamily? = null,
    textAlign: RemoteTextAlign? = null,
    overflow: RemoteTextOverflow = RemoteTextOverflow.Clip,
    maxLines: Int = Int.MAX_VALUE,
    fontVariationSettings: RemoteFontVariation.Settings? = null,
    style: RemoteTextStyle = RemoteTextStyle.Default
): Unit

Displays text in a remote layout.

This is the remote equivalent of Compose UI's androidx.compose.foundation.text.BasicText: a foundational building block that renders text from explicit parameters and style without reading Material theme colors or typography. For themed text that integrates with Material color schemes and typography, use a higher-level component such as androidx.wear.compose.remote.material3.RemoteText.

Commonly used properties from RemoteTextStyle are also exposed directly as parameters for convenience:

  • When a styling parameter is non-null, it overrides the corresponding property in style.

  • When null, the value from style is used instead, falling back to a default value if also unset in style.

Example of a basic RemoteBasicText:

import androidx.compose.remote.creation.compose.state.rc
import androidx.compose.remote.creation.compose.state.rs
import androidx.compose.remote.creation.compose.state.rsp
import androidx.compose.remote.foundation.text.RemoteBasicText
import androidx.compose.ui.graphics.Color

RemoteBasicText(text = "Hello Remote Compose".rs, color = Color.Black.rc, fontSize = 16.rsp)

Example of RemoteBasicText with bold and italic styling:

import androidx.compose.remote.creation.compose.layout.RemoteColumn
import androidx.compose.remote.creation.compose.state.rc
import androidx.compose.remote.creation.compose.state.rs
import androidx.compose.remote.creation.compose.state.rsp
import androidx.compose.remote.creation.compose.text.RemoteFontStyle
import androidx.compose.remote.creation.compose.text.RemoteFontWeight
import androidx.compose.remote.foundation.text.RemoteBasicText
import androidx.compose.ui.graphics.Color

RemoteColumn {
    RemoteBasicText(
        text = "Bold Text".rs,
        color = Color.Black.rc,
        fontSize = 18.rsp,
        fontWeight = RemoteFontWeight.Bold,
    )
    RemoteBasicText(
        text = "Italic Text".rs,
        color = Color.Gray.rc,
        fontSize = 14.rsp,
        fontStyle = RemoteFontStyle.Italic,
    )
}

Example of RemoteBasicText with a monospace RemoteFontFamily:

import androidx.compose.remote.creation.compose.state.rc
import androidx.compose.remote.creation.compose.state.rs
import androidx.compose.remote.creation.compose.state.rsp
import androidx.compose.remote.creation.compose.text.RemoteFontFamily
import androidx.compose.remote.foundation.text.RemoteBasicText
import androidx.compose.ui.graphics.Color

RemoteBasicText(
    text = "Monospace Font".rs,
    color = Color.Black.rc,
    fontSize = 16.rsp,
    fontFamily = RemoteFontFamily.Monospace,
)
Parameters
text: RemoteString

text to display

modifier: RemoteModifier = RemoteModifier

the RemoteModifier applied to this text layout

color: RemoteColor? = null

text color. If null, uses RemoteTextStyle.color from style, or opaque black (0xFF000000) if also null in style

fontSize: RemoteTextUnit? = null

glyph size. If null, uses RemoteTextStyle.fontSize from style, or 12.sp if also null in style

fontStyle: RemoteFontStyle? = null

typeface slope (such as RemoteFontStyle.Italic). If null, uses RemoteTextStyle.fontStyle from style, or RemoteFontStyle.Normal if also null in style

fontWeight: RemoteFontWeight? = null

typeface thickness (such as RemoteFontWeight.Bold). If null, uses RemoteTextStyle.fontWeight from style, or RemoteFontWeight.Normal if also null in style

fontFamily: RemoteFontFamily? = null

font family used to render the text. If null, uses RemoteTextStyle.fontFamily from style, or the platform default typeface if also null in style

textAlign: RemoteTextAlign? = null

horizontal alignment of the text within its container. If null, uses RemoteTextStyle.textAlign from style, or RemoteTextAlign.Start if also unset in style

overflow: RemoteTextOverflow = RemoteTextOverflow.Clip

how visual overflow is handled. Defaults to RemoteTextOverflow.Clip

maxLines: Int = Int.MAX_VALUE

maximum number of visible lines. Defaults to Int.MAX_VALUE

fontVariationSettings: RemoteFontVariation.Settings? = null

OpenType variable font axis settings. If null, uses RemoteTextStyle.fontVariationSettings from style, or applies no custom variation settings if also null in style

style: RemoteTextStyle = RemoteTextStyle.Default

base RemoteTextStyle configuration for properties such as color, font, letter spacing, and line height. Defaults to RemoteTextStyle.Default