Function

semantics

Add semantics key/value pairs to the layout node, for use in testing, accessibility, etc.

semantics

Source set: Android
public fun SubspaceModifier.semantics(
    properties: (SubspaceSemanticsPropertyReceiver.() -> Unit)
): SubspaceModifier

Add semantics key/value pairs to the layout node, for use in testing, accessibility, etc.

Mental Model (Picture Frame vs. Canvas): When building a combined UI in Compose for XR, think of a Subspace node (such as SpatialPanel) as a "Picture Frame" existing in 3D space, and the standard 2D Compose UI elements inside it as the "Canvas".

    (such as testTag and contentDescription) for 3D placement, anchoring, or testing.

  • Use SubspaceModifier.semantics on the 3D container (the frame) to provide spatial properties
  • (the canvas) for fine-grained user interactions and TalkBack accessibility.

  • Use standard androidx.compose.ui.semantics.semantics modifiers on the 2D Compose composables

Interop & Merging Guidance: The 3D Subspace semantics tree and the 2D foundational semantics tree operate as distinct hierarchies. Spatial containers do not support merging descendant semantics (mergeDescendants = true).

Parameters

properties Builder block where the semantics properties are defined.
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: