ModalScaffold

fun ModalScaffold(onClose: () -> Unit, modifier: Modifier = Modifier, contentPadding: PaddingValues = DialogPadding, contentWindowInsets: WindowInsets = ScaffoldDefaults.contentWindowInsets, snackbarHost: @Composable () -> Unit = {}, mainButton: @Composable (Modifier) -> Unit? = null, supportButton: @Composable (Modifier) -> Unit? = null, title: @Composable () -> Unit = {}, actions: @Composable RowScope.() -> Unit = {}, inEdgeToEdge: Boolean = LocalSparkFeatureFlag.current.isContainingActivityEdgeToEdge, content: @Composable (PaddingValues) -> Unit)(source)

A composable function that creates a full-screen modal scaffold, adapting its layout based on the device's screen size and orientation.

The scaffold provides different layouts for phone portrait, phone landscape, and other devices (e.g., tablets or foldables) where it'll show a modal instead.

To hide the Bottom App Bar, pass null to both mainButton and supportButton.

Parameters

onClose

callback that will be invoked when the modal is dismissed

snackbarHost

Component to host Snackbars that are pushed to be shown

modifier

applied to the root Scaffold

mainButton

the main actions for this modal (should be a ButtonFilled most of the time)

supportButton

the support or alternative actions for this modal (should any other button than ButtonFilled) portrait mode

title

the title of the modal

actions

the actions displayed at the end of the top app bar. This should typically be

  • IconButtons. The default layout here is a Row, so icons inside will be placed horizontally.

inEdgeToEdge

tell the component that the host activity uses edge-to-edge. This must be set explicitly because no API can reliably detect it.

content

the center custom Composable for modal content