Skip to content

Skeleton ​

A pulsing placeholder shown while content loads. Use it to reserve layout space and signal loading without a spinner. It is purely decorative and skipped by assistive tech.

Import ​

kotlin
import io.github.heartcoolman.prism.ui.PrismSkeleton

Basic usage ​

kotlin
PrismSkeleton(lines = 3)

Variants ​

Text renders lines bars (the last tapered to 60% when multi-line). Rect and Circle use the explicit width/height you supply; for Circle the diameter is width ?: height.

kotlin
// Multi-line text block
PrismSkeleton(variant = PrismSkeletonVariant.Text, lines = 3)

// Rectangle (e.g. an image placeholder)
PrismSkeleton(variant = PrismSkeletonVariant.Rect, width = 200.dp, height = 120.dp)

// Circle (e.g. an avatar placeholder)
PrismSkeleton(variant = PrismSkeletonVariant.Circle, width = 48.dp)

API ​

ParameterTypeDefaultDescription
modifierModifierModifierLayout modifier applied to the placeholder.
variantPrismSkeletonVariantPrismSkeletonVariant.TextPlaceholder shape.
widthDp?nullExplicit width for Rect; diameter for Circle. Text fills available width.
heightDp16.dpHeight for Rect; fallback diameter for Circle.
linesInt1Number of stacked bars for the Text variant.

PrismSkeletonVariant ​

kotlin
enum class PrismSkeletonVariant { Text, Rect, Circle }

Released under the MIT License.