<h2 id="shrinkhorizontally-animationspec-shrinktowards-clip-targetwidth">shrinkHorizontally</h2>

<div class='sourceset sourceset-common'>Common</div>

```kotlin
public fun shrinkHorizontally(
    animationSpec: FiniteAnimationSpec<IntSize> =
        spring(
            stiffness = Spring.StiffnessMediumLow,
            visibilityThreshold = IntSize.VisibilityThreshold,
        ),
    shrinkTowards: Alignment.Horizontal = Alignment.End,
    clip: Boolean = true,
    targetWidth: (fullWidth: Int) -> Int = { 0 },
): ExitTransition
```

This shrinks the clip bounds of the disappearing content horizontally, from the full width to the
width returned from `targetWidth`. `shrinkTowards` controls the direction of the bounds shrink
animation. By default, the clip bounds animates from full width to 0, shrinking towards the end
of the content.

__Note__: [shrinkHorizontally](/jetpack-compose/androidx.compose.animation/animation/functions/shrinkHorizontally) animates the bounds of the content. This bounds change will also
result in the animation of other layouts that are dependent on this size.

`targetWidth` is a lambda that takes the full width of the content and returns a target width of
the content. This allows not only absolute width, but also a target width that is proportional to
the content width.

[clip](/jetpack-compose/androidx.compose.ui/ui/modifiers/clip) defines whether the content outside of the animated bounds should be clipped. By default,
clip is set to true, which only shows content in the animated bounds.

#### Parameters

| | |
| --- | --- |
| animationSpec | the animation used for the shrinking animation, [spring](/jetpack-compose/androidx.compose.animation/animation-core/functions/spring) by default. |
| shrinkTowards | the ending point of the shrinking bounds, `Alignment.End` by default. |
| clip | whether the content outside of the animated bounds should be clipped, true by default |
| targetWidth | returns the end width of the shrinking bounds, 0 by default. |