API reference

WindowModifier Interface

Spatial configuration for a SpatialWindow — size, position, and placement-time appearance. Mirrors the mental model of Jetpack Compose's Modifier: chainable, immutable, and read in declaration order.
Each entry sets one property; entries declared later in the chain override earlier entries for the same property. Start from the empty WindowModifier companion:
SpatialWindow(
    key = "nav",
    modifier = WindowModifier
        .size(96.dp, 400.dp)
        .anchor(WindowAnchor.Start)
        .offset(z = OffsetStep.Near)
) { NavUI() }

Chains are immutable and safe to share, so common configurations can be hoisted as presets:
val NavStart = WindowModifier.size(96.dp, 400.dp).anchor(WindowAnchor.Start)
Window(key = "nav", modifier = NavStart) { NavUI() }

Changing a size or position modifier (e.g. swapping size(96.dp, 400.dp) for size(120.dp, 400.dp) after a state change) issues a single relayout of the window when the recomposition commits. State changes inside the window's content composable do not relayout the window — they only recompose the content within the existing window. Resize and reposition cost is therefore tied to changes in the modifier chain itself, not to UI state inside the window. Creation-only settings available in narrower API tiers require the window to be removed and recreated.

Signature

@Immutable interface WindowModifier

Methods

foldIn ( initial , operation )
Accumulates operation over every element in this chain, outer elements first.
Signature
abstract fun <R> foldIn(initial: R, operation: (R, WindowModifier.Element) -> R): R
Parameters
initial: WindowModifier
operation: (R, WindowModifier.Element) -> R
Returns
WindowModifier
then ( other )
Concatenates this modifier with other. Elements in other take precedence.
Signature
open infix fun then(other: WindowModifier): WindowModifier
Parameters
other: WindowModifier
Returns
WindowModifier

Extension Functions

anchor ( anchor )
Attaches the window to the given WindowAnchor. Later entries override earlier ones.
Signature
fun WindowModifier.anchor(anchor: WindowAnchor): WindowModifier
Extension declared in metavrx.layout.window.compose.layout
Parameters
anchor: WindowAnchor
Returns
WindowModifier
background ( color )
Sets the hosted window root's opaque background color. It paints behind Compose content during initial drawing and relayout, including pixels exposed while the window resizes. Later entries in the chain override earlier ones; absent, the root uses the app theme's android:windowBackground.
Only fully opaque colors are supported; this API cannot make the scene behind the window visible.
Signature
fun WindowModifier.background(color: Color): WindowModifier
Extension declared in metavrx.layout.window.compose.layout
Parameters
color: Color
Returns
WindowModifier
Throws
IllegalArgumentException  if color is not fully opaque.
height ( height )
Sets the window height in dp without changing its width. Pass WindowDefaults.MatchParent to match the full parent height, or use WindowModifier.matchParentHeight for fractional parent sizing. If no earlier modifier sets the width, the SDK's default width of 256.dp is retained.
Signature
fun WindowModifier.height(height: Dp): WindowModifier
Extension declared in metavrx.layout.window.compose.layout
Parameters
height: Dp
Returns
WindowModifier
matchParentHeight ( fraction )
Sets the window height to fraction of the parent panel's measured pixel height without changing its width. fraction must be greater than 0f and at most 1f; the default 1f matches the full parent height.
Signature
fun WindowModifier.matchParentHeight(fraction: Float = 1.0f): WindowModifier
Extension declared in metavrx.layout.window.compose.layout
Parameters
fraction: Float
Returns
WindowModifier
matchParentWidth ( fraction )
Sets the window width to fraction of the parent panel's measured pixel width without changing its height. fraction must be greater than 0f and at most 1f; the default 1f matches the full parent width.
Signature
fun WindowModifier.matchParentWidth(fraction: Float = 1.0f): WindowModifier
Extension declared in metavrx.layout.window.compose.layout
Parameters
fraction: Float
Returns
WindowModifier
offset ( offset )
Translates the window by a pre-built WindowOffset.
Signature
fun WindowModifier.offset(offset: WindowOffset): WindowModifier
Extension declared in metavrx.layout.window.compose.layout
Parameters
offset: WindowOffset
Returns
WindowModifier
offset ( x , y , z )
Translates the window after anchoring by the given discrete OffsetSteps.
Later entries override earlier ones — each call replaces the full offset.
Signature
fun WindowModifier.offset(
    x: OffsetStep = OffsetStep.None,
    y: OffsetStep = OffsetStep.None,
    z: OffsetStep = OffsetStep.None,
): WindowModifier
Extension declared in metavrx.layout.window.compose.layout
Parameters
x: OffsetStep
y: OffsetStep
z: OffsetStep
Returns
WindowModifier
offset ( x , y , z )
Translates the window by horizontal and vertical dp distances after anchoring, with an optional discrete depth offset.
This overload replaces the full offset set by an earlier WindowModifier.offset call. Use it when a window must align with existing content geometry that cannot be represented by OffsetStep values.
Signature
fun WindowModifier.offset(x: Dp, y: Dp, z: OffsetStep = OffsetStep.None): WindowModifier
Extension declared in metavrx.layout.window.compose.layout
Parameters
x: Dp
y: Dp
z: OffsetStep
Returns
WindowModifier
size ( size )
Sets the window size. Each dimension may use WindowDefaults.MatchParent to match the parent panel on that axis. Later size or per-axis modifiers override the dimensions they set.
Signature
fun WindowModifier.size(size: WindowSize): WindowModifier
Extension declared in metavrx.layout.window.compose.layout
Parameters
size: WindowSize
Returns
WindowModifier
size ( width , height )
Sets the window width and height in dp. Either dimension may be WindowDefaults.MatchParent. Later size or per-axis modifiers override the dimensions they set.
Signature
fun WindowModifier.size(width: Dp, height: Dp): WindowModifier
Extension declared in metavrx.layout.window.compose.layout
Parameters
width: Dp
height: Dp
Returns
WindowModifier
width ( width )
Sets the window width in dp without changing its height. Pass WindowDefaults.MatchParent to match the full parent width, or use WindowModifier.matchParentWidth for fractional parent sizing. If no earlier modifier sets the height, the SDK's default height of 256.dp is retained.
Signature
fun WindowModifier.width(width: Dp): WindowModifier
Extension declared in metavrx.layout.window.compose.layout
Parameters
width: Dp
Returns
WindowModifier

Companion Object

Empty modifier — the identity for WindowModifier.Companion.then. Begin chains here.

Methods

foldIn ( initial , operation )
Accumulates operation over every element in this chain, outer elements first.
Signature
open override fun <R> foldIn(initial: R, operation: (R, WindowModifier.Element) -> R): R
Parameters
initial: WindowModifier.Companion
operation: (R, WindowModifier.Element) -> R
Returns
WindowModifier.Companion
then ( other )
Concatenates this modifier with other. Elements in other take precedence.
Signature
open infix override fun then(other: WindowModifier): WindowModifier
Parameters
other: WindowModifier
Returns
WindowModifier

Inner Interface

Element Interface

Extends WindowModifier
A single entry in a WindowModifier chain.

Signature

interface Element : WindowModifier

Methods

foldIn ( initial , operation )
Accumulates operation over every element in this chain, outer elements first.
Signature
open override fun <R> foldIn(initial: R, operation: (R, WindowModifier.Element) -> R): R
Parameters
initial: WindowModifier.Element
operation: (R, WindowModifier.Element) -> R
Returns
WindowModifier.Element
then ( other )
Concatenates this modifier with other. Elements in other take precedence.
Signature
open infix fun then(other: WindowModifier): WindowModifier
Parameters
other: WindowModifier
Returns
WindowModifier