Start native apps faster with the Composables CLI ->
Composable Function

Subspace

Create a 3D area that the app can render spatial content into.

SubspaceSample

public fun SubspaceSample() {
    @Composable
    fun AppContent() {
        // By default, Subspace is automatically bounded by the system's recommended content box.
        // SubspaceModifiers like fillMaxSize() will expand to fill this recommended box.
        Subspace {
            SpatialPanel(SubspaceModifier.fillMaxSize()) {
                Text("Panel filling the default recommended content box")
            }
        }
        // To escape the default recommended content box constraints and define a custom
        // bounded or unbounded Subspace, apply the requiredSizeIn modifier.
        Subspace(
            modifier =
                SubspaceModifier.requiredSizeIn(
                    maxWidth = 10000.dp,
                    maxHeight = 10000.dp,
                    maxDepth = 10000.dp,
                )
        ) {
            SpatialPanel(SubspaceModifier.fillMaxSize()) {
                Text("Panel in a custom sized Subspace escaping default constraints")
            }
        }
    }
}

Last updated: