---
title: "RemoteText"
description: "Remote composable that displays text."
type: "composable"
---
## API Reference

### RemoteText

> Source set: Android

```kotlin
@Composable
public fun RemoteText(
    text: RemoteString,
    modifier: RemoteModifier = RemoteModifier,
    color: RemoteColor? = null,
    fontSize: RemoteTextUnit? = null,
    fontStyle: FontStyle? = null,
    fontWeight: FontWeight? = null,
    fontFamily: RemoteFontFamily? = null,
    textAlign: TextAlign? = null,
    overflow: TextOverflow = TextOverflow.Clip,
    maxLines: Int = Int.MAX_VALUE,
    style: RemoteTextStyle = RemoteTextStyle.Default,
    fontVariationSettings: FontVariation.Settings? = null,
)
```

Remote composable that displays text.

Note that density-dependent values like `fontSize`, `style#letterSpacing`, and `style#lineHeight`
are converted to pixels using [RemoteDensity](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteDensity/api) from the environment where the [RemoteText](/jetpack-compose/androidx.compose.remote/remote-creation-compose/composable-functions/RemoteText/api) is
being *created*, not the remote environment where it will be displayed. This means these values
are fixed at creation time based on the local density.

#### Parameters

| | |
| --- | --- |
| text | The text to be displayed. |
| modifier | The [RemoteModifier](/jetpack-compose/androidx.compose.remote/remote-creation-compose/interfaces/RemoteModifier) to be applied to this text. |
| color | [RemoteColor](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteColor) to apply to the text. If [color](/jetpack-compose/androidx.compose.ui/ui-graphics/classes/Color) is not specified, and it is not provided in [style](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/Style), then `Color.Black` will be used. |
| fontSize | The size of the font. |
| fontStyle | The font style to be applied to the text. |
| fontWeight | The font weight to be applied to the text. |
| fontFamily | The font family to be applied to the text. |
| textAlign | The alignment of the text within its container. |
| overflow | How visual overflow should be handled. |
| maxLines | An optional maximum number of lines for the text. |
| style | The [RemoteTextStyle](/jetpack-compose/androidx.compose.remote/remote-creation-compose/classes/RemoteTextStyle) to be applied to the text. |
| fontVariationSettings | The font variation settings to be applied to the text. |

## Code Examples

### RemoteTextSample

```kotlin
@Sampled
@PreviewWrapper(RemoteComponentPreviewWrapper::class)
@Composable
fun RemoteTextSample() {
    RemoteText(text = "Hello Remote Compose".rs, color = Color.Blue.rc, fontSize = 20.rsp)
}
```

### RemoteTextStylingSample

```kotlin
@Sampled
@PreviewWrapper(RemoteComponentPreviewWrapper::class)
@Composable
fun RemoteTextStylingSample() {
    RemoteText(
        text = "Bold & Italic".rs,
        fontWeight = FontWeight.Bold,
        fontStyle = FontStyle.Italic,
    )
}
```

### RemoteTextFontFamilySample

```kotlin
@Sampled
@PreviewWrapper(RemoteComponentPreviewWrapper::class)
@Composable
fun RemoteTextFontFamilySample() {
    RemoteColumn {
        RemoteText(text = "Serif".rs, fontFamily = RemoteFontFamily.Serif)
        RemoteText(text = "Sans Serif".rs, fontFamily = RemoteFontFamily.SansSerif)
        RemoteText(text = "Monospace".rs, fontFamily = RemoteFontFamily.Monospace)
        RemoteText(text = "ExtraBold".rs, fontWeight = FontWeight.ExtraBold)
        RemoteText(
            text = "Named Flex Font with Variations".rs,
            fontFamily = RemoteFontFamily.Named("device:roboto-flex"),
            fontVariationSettings =
                FontVariation.Settings(FontVariation.weight(300), FontVariation.width(70f)),
        )
    }
}
```
