androidx.compose.ui.draw
shadow
Function · from org.jetbrains.compose.ui:ui:1.12.2
No hand-written docs yet.
Creates a graphicsLayer that draws a shadow. The elevation defines the visual depth of the physical object. The physical object has a shape specified by shape.
Parameters
fun Modifier.shadow(
elevation: Dp,
shape: Shape = RectangleShape,
clip: Boolean = elevation > 0.dp,
ambientColor: Color = DefaultShadowColor,
spotColor: Color = DefaultShadowColor,
)
elevation: DpRequired
elevation: DpRequiredThe elevation for the shadow in pixels
shape: ShapeOptional
shape: ShapeOptionalDefault: RectangleShape
Defines a shape of the physical object
clip: BooleanOptional
clip: BooleanOptionalDefault: elevation > 0.dp
When active, the content drawing clips to the shape.
ambientColor: ColorOptional
ambientColor: ColorOptionalDefault: DefaultShadowColor
Color of the ambient shadow drawn when elevation > 0f
spotColor: ColorOptional
spotColor: ColorOptionalDefault: DefaultShadowColor
Color of the spot shadow that is drawn when elevation > 0f
Library docs
Creates a graphicsLayer that draws a shadow. The elevation defines the visual depth of the
physical object. The physical object has a shape specified by shape.
If the passed shape is concave the shadow will not be drawn on Android versions less than 10.
Note that elevation is only affecting the shadow size and doesn't change the drawing order. Use
a androidx.compose.ui.zIndex modifier if you want to draw the elements with larger elevation
after all the elements with a smaller one.
Note that this parameter is only supported on Android 9 (Pie) and above. On older versions, this
property always returns Color.Black and setting new values is ignored.
Usage of this API renders this composable into a separate graphics layer