A Scrim that obscures content behind a modal surface.

Common
@Composable
fun Scrim(
    contentDescription: String?,
    modifier: Modifier = Modifier,
    onClick: (() -> Unit)? = {},
    alpha: () -> Float = { 1f },
    color: Color = ScrimDefaults.color,
)

Parameters

contentDescription text used by accessibility services to describe what this Scrim can dismiss. This should always be provided unless the scrim is used for decorative purposes and onClick is null.
modifier Optional Modifier for the scrim.
onClick Optional callback invoked when the user clicks on the scrim, if set to null, no click semantics are provided.
alpha Opacity to be applied to the color from 0.0f to 1.0f representing fully transparent to fully opaque respectively. This is always coerced between 0.0f and 1.0f.
color The color of the scrim. This color must not be Color.Unspecified for this scrim to be drawn.