<div class='sourceset sourceset-common'>Common</div>

```kotlin
class Levitate(
        internal val alignment: Alignment = Alignment.Center,
        internal val scrim: (@Composable () -> Unit)? = null,
        internal val dragToResizeState: DragToResizeState? = null,
    ) : AdaptStrategy
```

Indicate the associated pane should be levitated when it's the current destination.

A levitated pane will be rendered above other panes in the pane scaffold like a pop-up or a
sheet (for example, as a bottom sheet or a side sheet.) A [scrim](/jetpack-compose/androidx.compose.material3/material3/components/Scrim) can be provided to block
interaction with the underlying panes.

With the default [calculateThreePaneScaffoldValue](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/functions/calculateThreePaneScaffoldValue) we provide, a pane with a levitate
strategy will be adapted to either:
1. [PaneAdaptedValue.Levitated](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/classes/PaneAdaptedValue.Levitated) with specified [alignment](/jetpack-compose/androidx.glance/glance/classes/Alignment), when the levitated pane is the  current destination; or
2. `PaneAdaptedValue.Hidden` otherwise.

#### Parameters

| | |
| --- | --- |
| alignment | the alignment of the associated pane when it's levitated, relatively to the pane scaffold. |
| scrim | the scrim to show when the pane is levitated to block user interaction with the underlying layout and emphasize the levitated pane; by default it will be `null` and no scrim will show; to display a scrim, we recommend to use [LevitatedPaneScrim](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/composable-functions/LevitatedPaneScrim) as a default implementation. |
| dragToResizeState | the optional state to enable the levitated pane to be resizable by dragging; it will be used to store and control current dragging; see [rememberDragToResizeState](/jetpack-compose/androidx.compose.material3.adaptive/adaptive-layout/composable-functions/rememberDragToResizeState) for more details about how to implement the drag-to-resize behavior. |

## Secondary Constructors

```kotlin
constructor(
        alignment: Alignment = Alignment.Center,
        scrim: (@Composable () -> Unit)? = null,
    ) : this(alignment, scrim, null)
```

## Functions

```kotlin
@Composable fun onlyIf(condition: Boolean): AdaptStrategy
```

This is a convenient function to only levitate the associated pane when the provided
condition is met. If the condition is not met, the pane will be expanded instead, if
there's enough room; otherwise it will be hidden.

<h2 id="onlyifsinglepane-scaffolddirective">onlyIfSinglePane</h2>

```kotlin
@Composable
        fun onlyIfSinglePane(scaffoldDirective: PaneScaffoldDirective): AdaptStrategy
```

This is a convenient function to only levitate the associated pane when it's a
single-pane layout. On multi-pane layouts, the pane will be expanded instead, if it's one
of the recent destinations.