---
title: Material3 adaptive
description: Use Crease fold state with Material3 adaptive window info, size classes and pane scaffolds through the crease-adaptive module, on Android foldables and the iPhone Duo.
---

`crease-adaptive` is an optional artifact. It gives the Material3 adaptive libraries the fold state that Crease reads, so `ListDetailPaneScaffold` and the other pane scaffolds also see the iPhone Duo's hinge. The adaptive libraries get their fold from Jetpack WindowManager, which does not exist on iOS.

```kotlin
// build.gradle.kts
commonMain.dependencies {
    implementation("io.github.jantursky:crease-adaptive:1.5.0")
}
```

The artifact depends on `org.jetbrains.compose.material3.adaptive:adaptive` 1.3.0 and `androidx.window:window-core`. `crease` and `crease-cover` do not, so apps that skip this artifact pull in nothing extra. Crease is tested against that adaptive version, and the API of the adaptive library has moved between releases, so check the version when you upgrade it.

## Window adaptive info

`rememberWindowAdaptiveInfo()` returns a `WindowAdaptiveInfo`. Its size class is the one `currentWindowAdaptiveInfoV2()` computes for the window, so the breakpoints are the ones current adaptive scaffolds use, including the Large and Extra-large widths. Its posture comes from `rememberFoldState()`.

```kotlin
import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi
import androidx.compose.material3.adaptive.layout.AnimatedPane
import androidx.compose.material3.adaptive.layout.ListDetailPaneScaffold
import androidx.compose.material3.adaptive.layout.calculatePaneScaffoldDirective
import androidx.compose.material3.adaptive.navigation.rememberListDetailPaneScaffoldNavigator
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import com.jantursky.crease.adaptive.rememberWindowAdaptiveInfo

@OptIn(ExperimentalMaterial3AdaptiveApi::class)
@Composable
fun Recipes() {
    val directive = calculatePaneScaffoldDirective(rememberWindowAdaptiveInfo())
    val navigator = rememberListDetailPaneScaffoldNavigator<String>(scaffoldDirective = directive)
    ListDetailPaneScaffold(
        directive = navigator.scaffoldDirective,
        value = navigator.scaffoldValue,
        listPane = { AnimatedPane { Text("Recipes") } },
        detailPane = { AnimatedPane { Text("Steps") } },
    )
}
```

On a half-open iPhone Duo the scaffold sees a separating hinge and puts the panes on either side of it. Inside this call Crease's posture replaces the adaptive library's own, including on Android, so the same code behaves the same on both platforms. If you need the library's own Android reading elsewhere, call `currentWindowAdaptiveInfoV2()` there.

## Converting a fold state

`FoldState.toWindowPosture()` is the pure conversion behind it. The posture is tabletop when `FoldState.posture` is `Tabletop`. Each fold becomes one hinge with the same bounds, orientation, separating and occluding flags, and a hinge counts as flat when the device reports it fully open. `FoldState.None` and a closed device give no hinges.

## One value for the layout

`rememberFoldLayoutClass()` returns a `FoldLayoutClass` with the `windowSizeClass` and the Crease `posture`. It changes when either does, and they change independently, so one `when` can pick the layout. Test the size class with `isWidthAtLeastBreakpoint` and `isHeightAtLeastBreakpoint`.

```kotlin
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.window.core.layout.WindowSizeClass
import com.jantursky.crease.Posture
import com.jantursky.crease.adaptive.rememberFoldLayoutClass

@Composable
fun Reader() {
    val layout = rememberFoldLayoutClass()
    when {
        layout.posture == Posture.Tabletop -> Text("Video above, controls below")
        !layout.windowSizeClass.isWidthAtLeastBreakpoint(WindowSizeClass.WIDTH_DP_MEDIUM_LOWER_BOUND) -> Text("One pane")
        else -> Text("Two panes")
    }
}
```

## Previews and tests

Both composables follow `ProvideFoldState`, so previews and tests can fix the posture without a device. `setContentWithFold()` from [`crease-test`](/guides/previews-and-tests) works the same way.

```kotlin
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.geometry.Size
import com.jantursky.crease.FoldState
import com.jantursky.crease.ProvideFoldState
import com.jantursky.crease.adaptive.rememberFoldLayoutClass

@Composable
fun BookPreview() {
    ProvideFoldState(FoldState.book(Size(1000f, 800f))) {
        Text("Posture: ${rememberFoldLayoutClass().posture}")
    }
}
```

## Cost and limits

The artifact is small. The Material3 adaptive libraries are the larger part, and only apps that add this artifact get them. It does not wrap `NavigationSuiteScaffold`, and it does not merge with the adaptive library's own Android fold reading: Crease's value is the one it returns.
