Skip to content

Layer

class Layer(
    val id: UUID = UUID.randomUUID(), 
    parentComposition: CompositionContext, 
    content: @Composable



 () -> Unit
)

A self-contained UI layer with its own independent LayoutNode tree and Composition.

Layers are used to implement overlapping UI surfaces such as modals, dropdowns, and tooltips. Each layer has its own root node that is measured and rendered separately from the base screen content.

Layers are managed by LayerStackManager. Do not create or dispose Layer instances directly; use LayerStackManager.push or LayerStackManager.modal instead.

Constructors

Layer

constructor(
    id: UUID = UUID.randomUUID(), 
    parentComposition: CompositionContext, 
    content: @Composable



 () -> Unit
)

Properties

composition

val composition: Composition

id

val id: UUID

rootNode

Functions

dispose

fun dispose()

Disposes the Compose Composition associated with this layer, releasing all remembered state and coroutines.

Called automatically by LayerStackManager.pop and LayerStackManager.popById.