Orbiter

Functions summary

Unit
@Composable
@ComposableOpenTarget(index = -1)
Orbiter(
    alignment: OrbiterAlignment,
    shape: SpatialShape,
    content: @Composable @UiComposable () -> Unit
)

This function is deprecated. Use the OrbiterPosition-based Orbiter instead.

Unit
@Composable
@ComposableOpenTarget(index = -1)
Orbiter(
    poseProvider: OrbiterPoseProvider,
    shape: SpatialShape,
    content: @Composable @UiComposable () -> Unit
)

This function is deprecated. Use the OrbiterPosition-based Orbiter instead.

Unit
@Composable
@ComposableOpenTarget(index = -1)
Orbiter(
    position: OrbiterPosition,
    shape: SpatialShape,
    content: @Composable @UiComposable () -> Unit
)

A composable that creates an orbiter along the edge or center of a parent spatial component.

Unit
@Composable
@ComposableOpenTarget(index = -1)
Orbiter(
    anchorPoint: OrbiterAnchorPoint,
    offset: DpVolumeOffset,
    shape: SpatialShape,
    content: @Composable @UiComposable () -> Unit
)

This function is deprecated. Use the OrbiterPosition-based Orbiter instead.

Unit
@Composable
@ComposableOpenTarget(index = -1)
Orbiter(
    position: ContentEdge.Horizontal,
    offset: Dp,
    offsetType: OrbiterOffsetType,
    alignment: Alignment.Horizontal,
    shape: SpatialShape,
    elevation: Dp,
    shouldRenderInNonSpatial: Boolean,
    content: @Composable @UiComposable () -> Unit
)

This function is deprecated. Use the OrbiterPosition-based Orbiter instead.

Unit
@Composable
@ComposableOpenTarget(index = -1)
Orbiter(
    position: ContentEdge.Vertical,
    offset: Dp,
    offsetType: OrbiterOffsetType,
    alignment: Alignment.Vertical,
    shape: SpatialShape,
    elevation: Dp,
    shouldRenderInNonSpatial: Boolean,
    content: @Composable @UiComposable () -> Unit
)

This function is deprecated. Use the OrbiterPosition-based Orbiter instead.

Functions

Orbiter

@Composable
@ComposableOpenTarget(index = -1)
fun Orbiter(
    alignment: OrbiterAlignment,
    shape: SpatialShape = OrbiterDefaults.Shape,
    content: @Composable @UiComposable () -> Unit
): Unit

Orbiter

@Composable
@ComposableOpenTarget(index = -1)
fun Orbiter(
    poseProvider: OrbiterPoseProvider,
    shape: SpatialShape = OrbiterDefaults.Shape,
    content: @Composable @UiComposable () -> Unit
): Unit

A composable that creates an orbiter along the edge of a spatial component (e.g. androidx.xr.compose.subspace.SpatialPanel).

Orbiters are floating elements that are typically used to control the content within spatial panels and other entities that they're anchored to. They allow the content to have more space and give users quick access to features like navigation without obstructing the main content.

The size of the Orbiter is constrained by the dimensions of its spatial parent. The spatial parent of the Orbiter is determined based on where the Orbiter is declared. When the orbiter is declared within:

Orbiters do not participate in their parent's layout and have no layout nodes in the containing compose hierarchy.

Parameters
poseProvider: OrbiterPoseProvider

A pose provider for calculating the offset pose of the orbiter relative to its spatial parent.

shape: SpatialShape = OrbiterDefaults.Shape

The shape of this Orbiter when it is rendered in 3D space.

content: @Composable @UiComposable () -> Unit

The content of the orbiter.

@Composable
@ComposableOpenTarget(index = -1)
fun Orbiter(
    position: OrbiterPosition,
    shape: SpatialShape = OrbiterDefaults.Shape,
    content: @Composable @UiComposable () -> Unit
): Unit

A composable that creates an orbiter along the edge or center of a parent spatial component.

Orbiters are floating elements that are typically used to control the content within spatial panels and other entities that they're anchored to. They allow the content to have more space and give users quick access to features like navigation without obstructing the main content.

Sizing constraints depend on where the orbiter is declared:

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Text
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.xr.compose.spatial.Orbiter
import androidx.xr.compose.spatial.OrbiterDefaults
import androidx.xr.compose.spatial.OrbiterPosition
import androidx.xr.compose.spatial.OrbiterPosition.EdgeAlignment
import androidx.xr.compose.subspace.SpatialPanel
import androidx.xr.compose.subspace.layout.SubspaceModifier
import androidx.xr.compose.subspace.layout.height
import androidx.xr.compose.subspace.layout.width
import androidx.xr.compose.unit.DpVolumeOffset

SpatialPanel(SubspaceModifier.width(400.dp).height(300.dp)) {
    // Place a horizontal bar orbiter at the bottom-center edge of the panel.
    Orbiter(
        position =
            OrbiterPosition.BottomCenter(
                offset = DpVolumeOffset(x = 0.dp, y = 0.dp, z = OrbiterDefaults.Elevation),
                verticalEdgeAlignment = EdgeAlignment.Center,
            )
    ) {
        Box(
            modifier = Modifier.size(200.dp, 64.dp).background(Color.DarkGray),
            contentAlignment = Alignment.Center,
        ) {
            Text("Bottom Bar", color = Color.White, fontSize = 18.sp)
        }
    }
}
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Text
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.xr.compose.spatial.Orbiter
import androidx.xr.compose.spatial.OrbiterDefaults
import androidx.xr.compose.spatial.OrbiterPosition
import androidx.xr.compose.spatial.OrbiterPosition.EdgeAlignment
import androidx.xr.compose.subspace.SpatialPanel
import androidx.xr.compose.subspace.layout.SubspaceModifier
import androidx.xr.compose.subspace.layout.height
import androidx.xr.compose.subspace.layout.width
import androidx.xr.compose.unit.DpVolumeOffset

SpatialPanel(SubspaceModifier.width(400.dp).height(300.dp)) {
    // Place the orbiter at the top-start corner: horizontally aligned inside the left edge,
    // but vertically sitting completely above (outside) the top edge.
    Orbiter(
        position =
            OrbiterPosition.TopStart(
                offset = DpVolumeOffset(x = 0.dp, y = 0.dp, z = OrbiterDefaults.Elevation),
                horizontalEdgeAlignment = EdgeAlignment.Inside,
                verticalEdgeAlignment = EdgeAlignment.Outside,
            )
    ) {
        Box(
            modifier = Modifier.size(200.dp, 64.dp).background(Color.DarkGray),
            contentAlignment = Alignment.Center,
        ) {
            Text("Top Rail", color = Color.White, fontSize = 18.sp)
        }
    }
}
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Text
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.xr.compose.spatial.Orbiter
import androidx.xr.compose.spatial.OrbiterDefaults
import androidx.xr.compose.spatial.OrbiterPosition
import androidx.xr.compose.spatial.OrbiterPosition.EdgeAlignment
import androidx.xr.compose.subspace.SpatialPanel
import androidx.xr.compose.subspace.layout.SubspaceModifier
import androidx.xr.compose.subspace.layout.height
import androidx.xr.compose.subspace.layout.width
import androidx.xr.compose.unit.DpVolumeOffset

SpatialPanel(SubspaceModifier.width(400.dp).height(300.dp)) {
    // Place the orbiter at the top-start corner: horizontally sitting completely to the side
    // (outside) of the left edge, but vertically aligned inside the top boundary.
    Orbiter(
        position =
            OrbiterPosition.TopStart(
                offset = DpVolumeOffset(x = 0.dp, y = 0.dp, z = OrbiterDefaults.Elevation),
                horizontalEdgeAlignment = EdgeAlignment.Outside,
                verticalEdgeAlignment = EdgeAlignment.Inside,
            )
    ) {
        Box(
            modifier = Modifier.size(64.dp, 200.dp).background(Color.DarkGray),
            contentAlignment = Alignment.Center,
        ) {
            Text("Rail", color = Color.White, fontSize = 18.sp)
        }
    }
}
Parameters
position: OrbiterPosition

position of the orbiter relative to the parent spatial component, defined by its alignment, edge alignment, and offset

shape: SpatialShape = OrbiterDefaults.Shape

shape of the orbiter when rendered in 3D space

content: @Composable @UiComposable () -> Unit

content to display inside the orbiter

Orbiter

@Composable
@ComposableOpenTarget(index = -1)
fun Orbiter(
    anchorPoint: OrbiterAnchorPoint,
    offset: DpVolumeOffset = DpVolumeOffset(0.dp, 0.dp, OrbiterDefaults.Elevation),
    shape: SpatialShape = OrbiterDefaults.Shape,
    content: @Composable @UiComposable () -> Unit
): Unit

A composable that creates an orbiter along the edge of a spatial component (e.g. androidx.xr.compose.subspace.SpatialPanel).

Orbiters are floating elements that are typically used to control the content within spatial panels and other entities that they're anchored to. They allow the content to have more space and give users quick access to features like navigation without obstructing the main content.

The size of the Orbiter is constrained by the dimensions of its spatial parent. The spatial parent of the Orbiter is determined based on where the Orbiter is declared. When the orbiter is declared within:

Parameters
anchorPoint: OrbiterAnchorPoint

The anchored position of the orbiter relative to the spatial component it is anchored to. OrbiterAnchorPoint is LayoutDirection aware.

offset: DpVolumeOffset = DpVolumeOffset(0.dp, 0.dp, OrbiterDefaults.Elevation)

The offset of the orbiter based on the outer edge of the orbiter.

shape: SpatialShape = OrbiterDefaults.Shape

The shape of this Orbiter when it is rendered in 3D space.

content: @Composable @UiComposable () -> Unit

The content of the orbiter.

Orbiter

@Composable
@ComposableOpenTarget(index = -1)
fun Orbiter(
    position: ContentEdge.Horizontal,
    offset: Dp = 0.dp,
    offsetType: OrbiterOffsetType = OrbiterOffsetType.OuterEdge,
    alignment: Alignment.Horizontal = Alignment.CenterHorizontally,
    shape: SpatialShape = OrbiterDefaults.Shape,
    elevation: Dp = OrbiterDefaults.Elevation,
    shouldRenderInNonSpatial: Boolean = true,
    content: @Composable @UiComposable () -> Unit
): Unit

A composable that creates an orbiter along the top or bottom edges of a view.

Orbiters are floating elements that are typically used to control the content within spatial panels and other entities that they're anchored to. They allow the content to have more space and give users quick access to features like navigation without obstructing the main content.

The size of the Orbiter is constrained by the dimensions of the parent spatial component it is anchored to (e.g., a androidx.xr.compose.subspace.SpatialPanel). If it's not placed within a specific spatial component, it defaults to the main window's size. Consequently, an Orbiter's content cannot be larger than its parent's dimensions.

Parameters
position: ContentEdge.Horizontal

The edge of the orbiter. Use ContentEdge.Top or ContentEdge.Bottom.

offset: Dp = 0.dp

The offset of the orbiter based on the outer edge of the orbiter.

offsetType: OrbiterOffsetType = OrbiterOffsetType.OuterEdge

The type of offset used for positioning the orbiter.

alignment: Alignment.Horizontal = Alignment.CenterHorizontally

The alignment of the orbiter. Use Alignment.CenterHorizontally or Alignment.Start or Alignment.End.

shape: SpatialShape = OrbiterDefaults.Shape

The shape of this Orbiter when it is rendered in 3D space.

elevation: Dp = OrbiterDefaults.Elevation

The z-direction elevation level of this Orbiter.

shouldRenderInNonSpatial: Boolean = true

In a non-spatial environment, if true the orbiter content is rendered as if the orbiter wrapper was not present and removed from the flow otherwise. In spatial environments, this flag is ignored.

content: @Composable @UiComposable () -> Unit

The content of the orbiter.

Example:

Orbiter(position = ContentEdge.Top, offset = 10.dp) {
Text("This is a top edge Orbiter")
}

Orbiter

@Composable
@ComposableOpenTarget(index = -1)
fun Orbiter(
    position: ContentEdge.Vertical,
    offset: Dp = 0.dp,
    offsetType: OrbiterOffsetType = OrbiterOffsetType.OuterEdge,
    alignment: Alignment.Vertical = Alignment.CenterVertically,
    shape: SpatialShape = OrbiterDefaults.Shape,
    elevation: Dp = OrbiterDefaults.Elevation,
    shouldRenderInNonSpatial: Boolean = true,
    content: @Composable @UiComposable () -> Unit
): Unit

A composable that creates an orbiter along the start or end edges of a view.

Orbiters are floating elements that are typically used to control the content within spatial panels and other entities that they're anchored to. They allow the content to have more space and give users quick access to features like navigation without obstructing the main content.

The size of the Orbiter is constrained by the dimensions of the parent spatial component it is anchored to (e.g., a androidx.xr.compose.subspace.SpatialPanel). If it's not placed within a specific spatial component, it defaults to the main window's size. Consequently, an Orbiter's content cannot be larger than its parent's dimensions.

Parameters
position: ContentEdge.Vertical

The edge of the orbiter. Use ContentEdge.Start or ContentEdge.End.

offset: Dp = 0.dp

The offset of the orbiter based on the outer edge of the orbiter.

offsetType: OrbiterOffsetType = OrbiterOffsetType.OuterEdge

The type of offset used for positioning the orbiter.

alignment: Alignment.Vertical = Alignment.CenterVertically

The alignment of the orbiter. Use Alignment.CenterVertically or Alignment.Top or Alignment.Bottom.

shape: SpatialShape = OrbiterDefaults.Shape

The shape of this Orbiter when it is rendered in 3D space.

elevation: Dp = OrbiterDefaults.Elevation

The z-direction elevation level of this Orbiter.

shouldRenderInNonSpatial: Boolean = true

In a non-spatial environment, if true the orbiter content is rendered as if the orbiter wrapper was not present and removed from the flow otherwise. In spatial environments, this flag is ignored.

content: @Composable @UiComposable () -> Unit

The content of the orbiter.

Example:

Orbiter(position = ContentEdge.Start, offset = 10.dp) {
Text("This is a start edge Orbiter")
}