Skip to content

XR — canonical composables

develop specs/develop/xr-composables.kmd

Material 3 XR canonical composables: Orbiter, SpatialPanel, SpaceToggleButton, UserSubspace, SpatialRow/Column/Box, AlertDialog spatialized. Strict extension to specs/develop/xr-preview.kmd (which retains status `preview`). Defines Koder naming + auto- spatialize defaults (TopAppBar, NavigationRail).

When this spec applies

Primary triggers

All triggers

Specification body

Spec — XR canonical composables

Strict extension to xr-preview.kmd (R1-R4). Adds R5-R10 with canonical composables list + auto-spatialize + per-component XR sub-tab contract.

R5 — Canonical composables

Material 3 XR ships composables that have Koder-equivalent naming:

Material 3 XR composableKoder equivalentPurpose
OrbiterKoderOrbiterFloating UI element orbiting the user (always visible)
SpatialPanelKoderSpatialPanel3D-anchored panel for content
SpaceToggleButtonKoderSpaceToggleButtonToggle entering/leaving XR space mode
EnableXrComponentOverridesKoderXrOverridesWrapper enabling auto-spatialize defaults
UserSubspaceKoderUserSubspacePersonal space of the user (default scope)
SpatialRowKoderSpatialRow3D row layout
SpatialColumnKoderSpatialColumn3D column layout
SpatialBoxKoderSpatialBox3D positional container
LayoutSpacerKoderLayoutSpacerSpacer in spatial layouts
AlertDialog spatializedKoderAlertDialog w/ XR modeAuto-spatializes in Subspace context

Koder prefix: ALL XR composables use Koder* prefix; underlying Jetpack XR APIs called internally per platform.

R6 — Auto-spatialize defaults

When wrapped in KoderUserSubspace (or equivalent Subspace context):

ComponentAuto-spatialize behavior
TopAppBarBecomes Orbiter anchored to top of user view
NavigationRailBecomes Orbiter anchored to left/right of user view
BottomAppBar / DockedToolbarBecomes Orbiter anchored to bottom of user view
AlertDialogRenders in panel anchored center-front
ModalBottomSheetRenders as 3D panel sliding from bottom
FABBecomes orbiter floating to user's right (LTR)

Component code unchanged — same widget API. Subspace context activates XR rendering automatically.

Opt-out: KoderXrOverrides(enableAutoSpatialize: false) keeps components flat.

R7 — Input handling

Input modeBehavior
Eye + pinch (primary XR input)Standard tap equivalent; gaze tracks hover
Hand trackingTouch gestures supported (swipe, drag, multi-touch)
VoiceVoice commands per voice/wake-word.kmd + voice-mode.kmd; XR-specific commands ("go back", "select")
Keyboard + mouse (devtime)Standard 2D interaction; spatial features dormant
Spatial controller (Quest, etc.)Per-device adapter

Click semantics preserved across all modes: a KoderButton clicked via gaze+pinch fires same callback as 2D tap.

R8 — Per-component XR sub-tab contract

When a component is declared XR-aware (xr.enabled: true in spec frontmatter), design-gen renders an additional sub-tab /components/<slug>/xr (per tools/design-gen#012).

XR sub-tab content per spec:

SectionContent
ComposablesKoderOrbiter / KoderSpatialPanel / etc. that this component uses or becomes
Auto-spatializeWhether KoderUserSubspace auto-spatializes this (true/false)
NotesComponent-specific XR considerations (e.g., depth, anchoring, gaze focus order)

Frontmatter declaration example:

---
name: AlertDialog
xr:
  enabled: true
  composables: [KoderAlertDialog]
  auto_spatialize: true
  notes: "Anchored center-front in user subspace; eye+pinch on actions"
---

R9 — Performance budget

XR mandatory: 60fps (16.6ms per frame). Higher tiers preferred where supported:

TierTarget
Tier 1 (Vision Pro)90fps (11.1ms)
Tier 2 (Quest, AndroidXR)90fps when supported; 72fps fallback (13.8ms)
Tier 3 (WebXR)60fps minimum

Degradation strategy on missed frames:

  1. Reduce spatial panel render quality (LOD).
  2. Drop secondary orbiters (keep only primary nav).
  3. Disable shape morph animations.
  4. Last resort: drop to 30fps with timewarp (Vision Pro / Quest only).

R10 — Tier coverage matrix

Per surface (component / scaffold / app), declare which XR tiers supported:

TierDevicesXR API surface
Tier 1 (premium)Apple Vision ProARKit + RealityKit; passthrough
Tier 2 (consumer)Meta Quest 3+, AndroidXR (Samsung XR headset, etc.)Jetpack XR SDK + OpenXR; passthrough on capable hardware
Tier 3 (web)WebXR-capable browsers (Chrome, Edge, Safari on Vision Pro)WebXR Device API
ExcludedMobile AR (Pixel/Vision-Lite); 2D fallback rendering onlyn/a

Koder Stack first ships Tier 2 (AndroidXR via Jetpack XR SDK) + Tier 1 (Vision Pro via SwiftUI bindings). Tier 3 WebXR is opt-in per product.

References