# dropShadow

Common/All

## Functions summary

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.https://developer.android.com/reference/kotlin/androidx/compose/ui/draw/dropShadow.modifier#(androidx.compose.ui.Modifier).dropShadow(androidx.compose.ui.graphics.Shape,kotlin.Function1)(shape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape, block: https://developer.android.com/reference/kotlin/androidx/compose/ui/draw/DropShadowScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Draws a drop shadow behind the rest of the content with the geometry specified by the given shape and the shadow properties defined the `https://developer.android.com/reference/kotlin/androidx/compose/ui/draw/DropShadowScope`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.https://developer.android.com/reference/kotlin/androidx/compose/ui/draw/dropShadow.modifier#(androidx.compose.ui.Modifier).dropShadow(androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.shadow.Shadow)(shape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape, shadow: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/shadow/Shadow)` 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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/shadow/Shadow`. | Cmn |

## Functions

### Modifier.dropShadow

Cmn Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/draw/Shadow.kt+function:dropShadow) Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.9.0)

```
fun Modifier.dropShadow(shape: Shape, block: DropShadowScope.() -> Unit): Modifier
```

Draws a drop shadow behind the rest of the content with the geometry specified by the given shape and the shadow properties defined the `https://developer.android.com/reference/kotlin/androidx/compose/ui/draw/DropShadowScope`. This is different than `https://developer.android.com/reference/kotlin/androidx/compose/ui/draw/shadow.modifier#(androidx.compose.ui.Modifier).shadow(androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Shape,kotlin.Boolean,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` 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. This is similar to `https://developer.android.com/reference/kotlin/androidx/compose/ui/draw/dropShadow.modifier#(androidx.compose.ui.Modifier).dropShadow(androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.shadow.Shadow)` except that specification of drop shadow parameters is done with the lambda with `https://developer.android.com/reference/kotlin/androidx/compose/ui/draw/DropShadowScope` allows for more efficient transformations for animated use cases without recomposition.

```kotlin
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.dropShadow
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.shadow.Shadow
import androidx.compose.ui.unit.dp

Box(Modifier.size(100.dp, 100.dp).dropShadow(RectangleShape, Shadow(12.dp)))
```

| Parameters |
|---|---|
| `shape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape` | Geometry of the shadow |
| `block: https://developer.android.com/reference/kotlin/androidx/compose/ui/draw/DropShadowScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/draw/DropShadowScope` block where shadow properties are defined |

### Modifier.dropShadow

Cmn Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/draw/Shadow.kt+function:dropShadow) Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.9.0)

```
fun Modifier.dropShadow(shape: Shape, shadow: Shadow): Modifier
```

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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/shadow/Shadow`. This is different than `https://developer.android.com/reference/kotlin/androidx/compose/ui/draw/shadow.modifier#(androidx.compose.ui.Modifier).shadow(androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Shape,kotlin.Boolean,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` 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.

```kotlin
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.dropShadow
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.shadow.Shadow
import androidx.compose.ui.unit.dp

Box(Modifier.size(100.dp, 100.dp).dropShadow(RectangleShape, Shadow(12.dp)))
```

| Parameters |
|---|---|
| `shape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape` | Geometry of the shadow |
| `shadow: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/shadow/Shadow` | Properties of the shadow like radius, spread, offset, and fill properties like the color or brush |