Composable Function

SharedTransitionLayout

[SharedTransitionLayout] creates a layout and a [SharedTransitionScope] for the child layouts in [content].

SharedTransitionLayout

Common
@Composable
public fun SharedTransitionLayout(
    modifier: Modifier = Modifier,
    content: @Composable SharedTransitionScope.() -> Unit,
)

SharedTransitionLayout creates a layout and a SharedTransitionScope for the child layouts in content. Any child (direct or indirect) of the SharedTransitionLayout can use the receiver scope SharedTransitionScope to create shared element or shared bounds transitions.

Note: SharedTransitionLayout creates a new Layout. For use cases where it's preferable to not introduce a new layout between content and the parent layout, consider using SharedTransitionScope instead.

Below is an example of using SharedTransitionLayout to create a shared element transition and a shared bounds transition at the same time. Please see the API docs for SharedTransitionScope.sharedElement and SharedTransitionScope.sharedBounds for more simplified examples of using these APIs separately.

Parameters

modifier Modifiers to be applied to the layout.
content The children composable to be laid out.