androidx.compose.material3.adaptive.layout
ListDetailPaneScaffoldExperimental
Composable function · from org.jetbrains.compose.material3.adaptive:adaptive-layout:1.3.0
A list-detail layout shows a list, and the details of the item the user picked. Think of a mail app.
- On a wide window, the list and the detail show side by side.
- On a phone, only one pane shows. Picking an item opens the detail; back goes to the list.
You don't write the "if wide, else" yourself. A navigator knows the window size and which item is open, and the scaffold shows the right panes.

val messages = listOf("Lunch on Friday?", "Your order has shipped", "Photos from the trip", "Meeting notes")
Box(Modifier.size(840.dp, 300.dp)) { Inbox(windowWidthDp = 840) }
/** A list of messages and the selected one. Works with one pane or two. */
@Composable
fun Inbox(windowWidthDp: Int) {
val scope = rememberCoroutineScope()
// The navigator decides which panes show. In an app, call it without arguments:
// it reads the window size itself.
val navigator = rememberListDetailPaneScaffoldNavigator<Int>(
scaffoldDirective = calculatePaneScaffoldDirective(
WindowAdaptiveInfo(WindowSizeClass.BREAKPOINTS_V2.computeWindowSizeClass(widthDp = windowWidthDp, heightDp = 480), Posture()),
),
)
val selected = navigator.currentDestination?.contentKey
ListDetailPaneScaffold(
directive = navigator.scaffoldDirective,
scaffoldState = navigator.scaffoldState,
listPane = {
AnimatedPane {
LazyColumn {
itemsIndexed(messages) { index, message ->
ListItem(
headlineContent = { Text(message) },
colors = ListItemDefaults.colors(
containerColor = if (index == selected) MaterialTheme.colorScheme.secondaryContainer
else MaterialTheme.colorScheme.surface,
),
modifier = Modifier.clickable {
scope.launch { navigator.navigateTo(ListDetailPaneScaffoldRole.Detail, index) }
},
)
}
}
}
},
detailPane = {
AnimatedPane {
Column(Modifier.fillMaxSize().background(MaterialTheme.colorScheme.surfaceContainerLow).padding(16.dp)) {
// Only needed when the list is hidden (one pane).
if (navigator.canNavigateBack()) {
IconButton(onClick = { scope.launch { navigator.navigateBack() } }) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, "Back")
}
}
Text(selected?.let { messages[it] } ?: "Pick a message", style = MaterialTheme.typography.titleLarge)
}
}
},
)
}

val messages = listOf("Lunch on Friday?", "Your order has shipped", "Photos from the trip", "Meeting notes")
Box(Modifier.size(360.dp, 300.dp)) { Inbox(windowWidthDp = 360) }
/** A list of messages and the selected one. Works with one pane or two. */
@Composable
fun Inbox(windowWidthDp: Int) {
val scope = rememberCoroutineScope()
// The navigator decides which panes show. In an app, call it without arguments:
// it reads the window size itself.
val navigator = rememberListDetailPaneScaffoldNavigator<Int>(
scaffoldDirective = calculatePaneScaffoldDirective(
WindowAdaptiveInfo(WindowSizeClass.BREAKPOINTS_V2.computeWindowSizeClass(widthDp = windowWidthDp, heightDp = 480), Posture()),
),
)
val selected = navigator.currentDestination?.contentKey
ListDetailPaneScaffold(
directive = navigator.scaffoldDirective,
scaffoldState = navigator.scaffoldState,
listPane = {
AnimatedPane {
LazyColumn {
itemsIndexed(messages) { index, message ->
ListItem(
headlineContent = { Text(message) },
colors = ListItemDefaults.colors(
containerColor = if (index == selected) MaterialTheme.colorScheme.secondaryContainer
else MaterialTheme.colorScheme.surface,
),
modifier = Modifier.clickable {
scope.launch { navigator.navigateTo(ListDetailPaneScaffoldRole.Detail, index) }
},
)
}
}
}
},
detailPane = {
AnimatedPane {
Column(Modifier.fillMaxSize().background(MaterialTheme.colorScheme.surfaceContainerLow).padding(16.dp)) {
// Only needed when the list is hidden (one pane).
if (navigator.canNavigateBack()) {
IconButton(onClick = { scope.launch { navigator.navigateBack() } }) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, "Back")
}
}
Text(selected?.let { messages[it] } ?: "Pick a message", style = MaterialTheme.typography.titleLarge)
}
}
},
)
}
The steps:
- Create a navigator with
rememberListDetailPaneScaffoldNavigator. The type argument is the key of an item, here anInt. - Pass its
scaffoldDirectiveandscaffoldStatetoListDetailPaneScaffold. - Wrap each pane's content in
AnimatedPane. - When the user picks an item, call
navigator.navigateTo(ListDetailPaneScaffoldRole.Detail, key). - Read the open item from
navigator.currentDestination?.contentKey.
navigateTo and navigateBack are suspend functions. Call them from rememberCoroutineScope().launch { }.
On a phone, give the detail pane a back button that calls navigator.navigateBack(). Show it only when navigator.canNavigateBack() is true. For the system back gesture, see the Adaptive layouts guide.
This is in a separate library: org.jetbrains.compose.material3.adaptive:adaptive-layout, plus adaptive-navigation for the navigator. It is experimental: add @OptIn(ExperimentalMaterial3AdaptiveApi::class).
With a valueExperimental
You say which panes show. For full control or tests.
@Composable
fun ListDetailPaneScaffold(
directive: PaneScaffoldDirective,
value: ThreePaneScaffoldValue,
listPane: @Composable ThreePaneScaffoldPaneScope.() -> Unit,
detailPane: @Composable ThreePaneScaffoldPaneScope.() -> Unit,
modifier: Modifier = Modifier,
extraPane: (@Composable ThreePaneScaffoldPaneScope.() -> Unit)? = null,
paneExpansionDragHandle: (@Composable ThreePaneScaffoldScope.(PaneExpansionState) -> Unit)? = null,
paneExpansionState: PaneExpansionState? = null,
)
directive: PaneScaffoldDirectiveRequired
directive: PaneScaffoldDirectiveRequiredHow many panes fit and how much space goes between them. Pass navigator.scaffoldDirective.
To make your own, see calculatePaneScaffoldDirective.
value: ThreePaneScaffoldValueRequired
value: ThreePaneScaffoldValueRequiredWhich panes show and which are hidden, as a fixed value. Usually you pass scaffoldState instead.
listPane: @Composable ThreePaneScaffoldPaneScope.() -> UnitRequired
listPane: @Composable ThreePaneScaffoldPaneScope.() -> UnitRequiredThe list. Wrap it in AnimatedPane { }.
detailPane: @Composable ThreePaneScaffoldPaneScope.() -> UnitRequired
detailPane: @Composable ThreePaneScaffoldPaneScope.() -> UnitRequiredThe details of the open item. Wrap it in AnimatedPane { }. Show a hint like "Pick a message" when nothing is open.
modifier: ModifierOptional
modifier: ModifierOptionalDefault: Modifier
Changes size, padding, or position. See the Modifier guide.
extraPane: (@Composable ThreePaneScaffoldPaneScope.() -> Unit)?Optional
extraPane: (@Composable ThreePaneScaffoldPaneScope.() -> Unit)?OptionalDefault: null
An optional third pane, for more about the detail, like attachments. It shows next to the detail on very wide windows, and replaces it on smaller ones.
paneExpansionDragHandle: (@Composable ThreePaneScaffoldScope.(PaneExpansionState) -> Unit)?OptionalSince 1.1
paneExpansionDragHandle: (@Composable ThreePaneScaffoldScope.(PaneExpansionState) -> Unit)?OptionalSince 1.1Default: null
A handle between the panes that the user drags to change their widths. Usually a VerticalDragHandle with Modifier.paneExpansionDraggable(...).
paneExpansionState: PaneExpansionState?OptionalSince 1.1
paneExpansionState: PaneExpansionState?OptionalSince 1.1Default: null
Remembers where the user dragged the handle. Create it with rememberPaneExpansionState.
With a stateExperimental
Animates between layouts. Use this with a navigator.
@Composable
fun ListDetailPaneScaffold(
directive: PaneScaffoldDirective,
scaffoldState: ThreePaneScaffoldState,
listPane: @Composable ThreePaneScaffoldPaneScope.() -> Unit,
detailPane: @Composable ThreePaneScaffoldPaneScope.() -> Unit,
modifier: Modifier = Modifier,
extraPane: (@Composable ThreePaneScaffoldPaneScope.() -> Unit)? = null,
paneExpansionDragHandle: (@Composable ThreePaneScaffoldScope.(PaneExpansionState) -> Unit)? = null,
paneExpansionState: PaneExpansionState? = null,
)
scaffoldState: ThreePaneScaffoldStateRequiredSince 1.1
scaffoldState: ThreePaneScaffoldStateRequiredSince 1.1Which panes show, with animations between changes. Pass navigator.scaffoldState.
Same as above: directive, listPane, detailPane, modifier, extraPane, paneExpansionDragHandle, paneExpansionState.
Parts
ListDetailPaneScaffoldAnimatedPaneLevitatedPaneScrim
See also
ListDetailPaneScaffoldDefaults: default values and helper functions forListDetailPaneScaffold.