RemoteText

Functions summary

Unit
@Composable
@RemoteComposable
RemoteText(
    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 Material Design text and provides accessibility semantics in a remote layout.

Functions

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

Displays Material Design text and provides accessibility semantics in a remote layout.

This is the Wear Material 3 counterpart to RemoteBasicText and the remote equivalent of androidx.wear.compose.material3.Text, integrating with theme colors, typography, and ambient text configuration via LocalRemoteTextConfiguration provided by surrounding Wear Material 3 components.

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 styling RemoteText with RemoteMaterialTheme.typography and theme colors:

import androidx.compose.remote.creation.compose.state.rs
import androidx.compose.remote.creation.compose.text.RemoteTextAlign
import androidx.compose.remote.creation.compose.text.RemoteTextOverflow
import androidx.wear.compose.remote.material3.RemoteMaterialTheme
import androidx.wear.compose.remote.material3.RemoteText

RemoteText(
    text = "Wear Material 3".rs,
    modifier = modifier,
    color = RemoteMaterialTheme.colorScheme.primary,
    style = RemoteMaterialTheme.typography.titleMedium,
    textAlign = RemoteTextAlign.Center,
    maxLines = 2,
    overflow = RemoteTextOverflow.Ellipsis,
)
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 the ambient content color 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? = LocalRemoteTextConfiguration.current.textAlign

horizontal alignment of the text within its container. Defaults to the ambient text configuration's alignment; if null, uses RemoteTextStyle.textAlign from style, or RemoteTextAlign.Start if also unset in style

overflow: RemoteTextOverflow = LocalRemoteTextConfiguration.current.overflow

how visual overflow is handled. Defaults to the ambient text configuration's overflow

maxLines: Int = LocalRemoteTextConfiguration.current.maxLines

maximum number of visible lines (must be greater than zero). Defaults to the ambient text configuration's maxLines

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 = LocalRemoteTextStyle.current

base RemoteTextStyle configuration for properties such as color, font, letter spacing, and line height. Defaults to the ambient text style provided by surrounding Wear Material 3 components