Scrim

A Scrim that obscures content behind a modal surface.

Scrim

Composable Component

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

contentDescriptiontext 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.
modifierOptional Modifier for the scrim.
onClickOptional callback invoked when the user clicks on the scrim, if set to null, no click semantics are provided.
alphaOpacity 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.
colorThe color of the scrim. This color must not be Color.Unspecified for this scrim to be drawn.