<h2 id="slideouthorizontally-animationspec-targetoffsetx">slideOutHorizontally</h2>

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

```kotlin
public fun slideOutHorizontally(
    animationSpec: FiniteAnimationSpec<IntOffset> =
        spring(
            stiffness = Spring.StiffnessMediumLow,
            visibilityThreshold = IntOffset.VisibilityThreshold,
        ),
    targetOffsetX: (fullWidth: Int) -> Int = { -it / 2 },
): ExitTransition
```

This slides out the content horizontally, from 0 to a target offset defined in `targetOffsetX` in
**pixels**. The direction of the slide can be controlled by configuring the `targetOffsetX`. A
positive value means sliding to the right, whereas a negative value would slide the content
towards the left.

`targetOffsetX` is a lambda that takes the full width of the content and returns an offset. This
allows the target offset to be defined proportional to the full size, or as an absolute value. It
defaults to return half of negative width, which would slide the content to the left by half of
its width.

#### Parameters

| | |
| --- | --- |
| animationSpec | the animation used for the slide-out, [spring](/jetpack-compose/androidx.compose.animation/animation-core/functions/spring) by default. |
| targetOffsetX | a lambda that takes the full width of the content and returns the initial offset for the slide-in, by default it returns `fullWidth/2` |