Skeleton

fun Skeleton(modifier: Modifier = Modifier, loading: Boolean = true)(source)

Skeleton is a visual component for content being loaded which create the impression of faster, gradual loading.

Parameters

modifier

provide size parameters with the modifier otherwise will fill max size of its container.

loading

if the animation shows loading progress or not

See also

Samples

var isLoading by remember { mutableStateOf(true) }
if (isLoading) {
    LaunchedEffect(Unit) {
        while (true) {
            delay(5000L)
            isLoading = false
        }
    }
}
SkapaTheme2(isSystemInDarkTheme()) {
    AspectRatioBox(aspectRatio = SkapaAspectRatio.Ratio1by1) {
        if (isLoading) {
            Skeleton(modifier = Modifier.fillMaxSize())
        } else {
            Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
                Text(text = "Show Your content")
            }
        }
    }
}