TwoPane

fun TwoPane(first: @Composable () -> Unit, second: @Composable () -> Unit, strategy: TwoPaneStrategy, displayFeatures: List<DisplayFeature>, modifier: Modifier = Modifier, foldAwareConfiguration: FoldAwareConfiguration = FoldAwareConfiguration.AllFolds)

A layout that places two different pieces of content defined by the first and second slots where the arrangement, sizes and separation behaviour is controlled by TwoPaneStrategy.

TwoPane is fold and hinges aware using the provided the displayFeatures (which should normally be calculated via calculateDisplayFeatures). The layout will be adapted to properly separate first and second panes so they don't interfere with hardware hinges (vertical or horizontal) as specified in displayFeatures, or respect folds when needed (for example, when foldable is half-folded (90-degree fold AKA tabletop) the split will become on the bend).

To only be aware of folds with a specific orientation, pass in an alternate foldAwareConfiguration to only adjust for vertical or horizontal folds.

The TwoPane layout will always place both first and second, based on the provided strategy and window environment. If you instead only want to place one or the other, that should be controlled at a higher level and not calling TwoPane if placing both is not desired.

Parameters

first

the first content of the layout, a left-most in LTR, a right-most in RTL and top-most in a vertical split based on the SplitResult of TwoPaneStrategy.calculateSplitResult

second

the second content of the layout, a right-most in the LTR, a left-most in the RTL and the bottom-most in a vertical split based on the SplitResult of TwoPaneStrategy.calculateSplitResult

strategy

strategy of the two pane that controls the arrangement of the layout

displayFeatures

the list of known display features to automatically avoid

foldAwareConfiguration

the types of display features to automatically avoid

modifier

an optional modifier for the layout