placeholder Text
Draws a multi-line text-shaped placeholder over content while it is loading.
Unlike placeholder which draws a single rectangle covering the host's bounds, this modifier renders lines horizontal bars sized to match the supplied TextStyle's lineHeight / fontSize, with the last bar narrowed to lastLineFraction for a realistic "ragged ending" feel. While enabled is true the host is forced to have at least lines × lineHeight of vertical space so empty / null Text composables still reserve room for the skeleton.
Defaults for color, shape, highlight, and the fade specs are sourced from LocalPlaceholderTheme. When wrapped in a PlaceholderSurface every bar shares the scope's coordinator and shimmers in lockstep with surrounding placeholders.
Example:
Text(
text = body ?: "",
style = MaterialTheme.typography.bodyLarge,
modifier = Modifier.placeholderText(
enabled = body == null,
lines = 3,
style = MaterialTheme.typography.bodyLarge,
),
)Parameters
Whether the skeleton should be visible. When false, the actual content is shown.
Number of skeleton bars to draw.
Width of the final bar relative to the host's width, in 0f..1f.
Text style used to derive line height and bar height. Defaults to LocalTextStyle.