RemoteBasicIcon

Functions summary

Unit
@RemoteComposable
@Composable
RemoteBasicIcon(
    imageVector: RemoteImageVector,
    contentDescription: RemoteString?,
    modifier: RemoteModifier,
    tint: RemoteColor
)

Composable function that displays an icon using an RemoteImageVector.

Functions

@RemoteComposable
@Composable
fun RemoteBasicIcon(
    imageVector: RemoteImageVector,
    contentDescription: RemoteString?,
    modifier: RemoteModifier = RemoteModifier,
    tint: RemoteColor = Color.White.rc
): Unit

Composable function that displays an icon using an RemoteImageVector.

This function provides a way to display icons consistently across both local and remote Compose environments.

import androidx.compose.remote.creation.compose.capture.RemoteImageVector
import androidx.compose.remote.creation.compose.capture.path
import androidx.compose.remote.creation.compose.modifier.RemoteModifier
import androidx.compose.remote.creation.compose.modifier.size
import androidx.compose.remote.creation.compose.state.RemoteColor
import androidx.compose.remote.creation.compose.state.rc
import androidx.compose.remote.creation.compose.state.rdp
import androidx.compose.remote.creation.compose.state.rf
import androidx.compose.remote.creation.compose.state.rs
import androidx.compose.remote.foundation.icon.RemoteBasicIcon
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor

val remoteImageVector =
    RemoteImageVector.Builder(
            viewportWidth = 24.0f.rf,
            viewportHeight = 24.0f.rf,
            tintColor = RemoteColor(Color.White),
            name = "Sample Icon",
        )
        .path(fill = SolidColor(Color.White)) {
            moveTo(4.0f.rf, 4.0f.rf)
            lineTo(20.0f.rf, 4.0f.rf)
            lineTo(20.0f.rf, 20.0f.rf)
            lineTo(4.0f.rf, 20.0f.rf)
            close()
        }
        .build()

RemoteBasicIcon(
    imageVector = remoteImageVector,
    contentDescription = "Sample Icon".rs,
    modifier = RemoteModifier.size(24.rdp),
    tint = Color.Red.rc,
)
Parameters
imageVector: RemoteImageVector

The RemoteImageVector representing the icon to display.

contentDescription: RemoteString?

Text used by accessibility services to describe what this icon represents. This should always be provided unless this icon is used for decorative purposes, and does not represent a meaningful action that a user can take. This text should be localized, such as by using androidx.compose.ui.res.stringResource or similar.

modifier: RemoteModifier = RemoteModifier

The RemoteModifier to apply to the icon.

tint: RemoteColor = Color.White.rc

The color to apply to the icon. Defaults to Color.White.