Kinetic UI
Back to Introduction
AI & Generative

Spatial UI (VisionOS)

A suite of 3D, depth-aware components inspired by Apple Vision Pro's eye-tracking and spatial computing interface.

Quick Actions
CLI Installation
npx kinetic-ui-cli@latest add spatial-ui
Spatial UI

VisionOS

Spatial Computing

Immersive Interfaces

Hover over this card to interact with the 3D depth, specular highlights, and magnetic buttons.

Installation

npx kinetic-ui-cli@latest add spatial-ui

Usage

import { SpatialCard, SpatialButton } from "@/components/creative/spatial-ui";

export default function Page() {
  return (
    <SpatialCard className="w-96 h-64">
      <div className="flex flex-col h-full items-center justify-center gap-6">
        <h2 className="text-2xl text-white font-light">Spatial Computing</h2>
        
        <SpatialButton onClick={() => alert("Clicked!")}>
          Enter Environment
        </SpatialButton>
      </div>
    </SpatialCard>
  );
}

How it works

This component heavily leverages Framer Motion's useMotionValue and useSpring to map your cursor position to a 3D coordinate space.

  • Perspective & Depth: The parent container uses perspective: 2000px, and the inner content wrapper uses translateZ to physically push the content outward towards the user.
  • Specular Highlights: A dynamic CSS radial-gradient follows your mouse cursor across the card, simulating real-world light reflecting off a glass surface.
  • Magnetic Buttons: The SpatialButton components actually move their x and y coordinates slightly towards your cursor, mimicking the "magnetic snap" effect seen in VisionOS when you look at a button.

Usage Guide

1. Import the Component

Import the component into your React or Next.js page:

import { SpatialUi } from "@/components/creative/spatial-ui";

2. Implementation Example

Render the component and customize its behavior by passing props:

import { SpatialUi } from "@/components/creative/spatial-ui";

export default function Example() {
  return (
    <div className="w-full flex items-center justify-center p-8">
      <SpatialUi
      >
        <div>Content goes here</div>
      </SpatialUi>
    </div>
  );
}
Performance Notes
  • Uses CSS hardware acceleration via GPU transform-binds.
  • Damped interpolation minimizes paint-redraw flashes.
  • Tree-shakable import: only compiles elements requested.
Accessibility Notes
  • Full keyboard focus-ring navigation support (`Tab`/`Shift+Tab`).
  • ARIA roles mapped correctly for assistive screen readers.
  • Respects `prefers-reduced-motion` system toggles.