dropShadow
Common
Modifier in Compose Ui
Draws a drop shadow behind the rest of the content with the geometry specified by the given shape and the shadow properties defined by the [Shadow]. This is different than [Modifier.shadow] as this does not introduce a graphicsLayer to render elevation based shadows. This shadow is rendered without a single light source and will render consistently regardless of the on screen position of the content.
Last updated:
Installation
dependencies {
implementation("androidx.compose.ui:ui:1.9.0-beta02")
}
Overloads
@Stable
fun Modifier.dropShadow(shape: Shape, shadow: Shadow): Modifier
Parameters
name | description |
---|---|
shape | Geometry of the shadow |
shadow | Properties of the shadow like radius, spread, offset, and fill properties like the color or brush |
@Stable
fun Modifier.dropShadow(shape: Shape, block: DropShadowScope.() -> Unit)
Parameters
name | description |
---|---|
shape | Geometry of the shadow |
block | [DropShadowScope] block where shadow properties are defined |
Code Example
DropShadowSample
@Composable
fun DropShadowSample() {
Box(Modifier.size(100.dp, 100.dp).dropShadow(RectangleShape, Shadow(12.dp)))
}