Components

From moasq/nanowave · View interactive version

Components is an AI agent skill from the GitHub repository moasq/nanowave. visionOS UI components: glass backgrounds, hover effects, ornaments, 3D content views. Use when working on visionOS component patterns, spatial UI, or Vision Pro interactions. Triggers: Button, glass, hover, ornament, RealityView, Model3D, component.

How to use this skill

Skill file

Component Patterns (visionOS)

CRITICAL — Glass-First, Minimal Color

visionOS windows use system glass material by default. The glass auto-adapts brightness based on the physical environment. Custom opaque backgrounds destroy this adaptive behavior.

BANNED on visionOS:

REQUIRED on visionOS:

// CORRECT — glass container, system text
VStack {
    Text("Settings")
        .font(AppTheme.Fonts.title)
        .foregroundStyle(.primary)      // system vibrancy — auto-adapts
    Text("Configure your preferences")
        .font(AppTheme.Fonts.body)
        .foregroundStyle(.secondary)    // dimmer vibrancy level
}
.padding(AppTheme.Spacing.lg)
.glassBackgroundEffect()

// BANNED — opaque colored background
VStack { content }
    .background(AppTheme.Colors.background) // NO — destroys glass
    .foregroundStyle(AppTheme.Colors.primary) // NO — colored body text

AppTheme Color Usage on visionOS

AppTheme colors are ONLY for:

AppTheme colors must NEVER be used for:

Hover Effects

ALL interactive elements MUST have .hoverEffect() for eye tracking feedback:

Button("Play") {
    play()
}
.hoverEffect()

// Custom hover effect
Button { } label: {
    Image(systemName: "star")
        .font(AppTheme.Fonts.title)
}
.hoverEffect(.highlight)

Button Styles

// Bordered prominent (primary action — accent color tint is appropriate here)
Button("Start", systemImage: "play.fill") {
    start()
}
.buttonStyle(.borderedProminent)
.buttonBorderShape(.capsule)
.hoverEffect()

// Bordered (secondary action)
Button("Settings", systemImage: "gear") {
    openSettings()
}
.buttonStyle(.bordered)
.buttonBorderShape(.roundedRectangle)
.hoverEffect()

BUTTON HIERARCHY:

| Level | Style | Use Case |

|-------|-------|----------|

| Primary action | .borderedProminent | Start, Play, Confirm |

| Secondary | .bordered | Settings, More Info |

| Tertiary | .borderless | Dismiss, Cancel |

Ornaments

Ornaments attach supplementary controls to windows:

.ornament(attachmentAnchor: .scene(.bottom)) {
    HStack(spacing: 20) {
        Button("Previous", systemImage: "backward.fill") {
            previous()
        }
        Button("Play", systemImage: "play.fill") {
            play()
        }
        Button("Next", systemImage: "forward.fill") {
            next()
        }
    }
    .padding()
    .glassBackgroundEffect()
}

3D Content — RealityView

For interactive 3D content:

import RealityKit

RealityView { content in
    if let entity = try? await Entity(named: "Scene", in: realityKitContentBundle) {
        content.add(entity)
    }
}

3D Content — Model3D

For simple 3D model display (no interaction):

import RealityKit

Model3D(named: "Globe") { model in
    model
        .resizable()
        .scaledToFit()
} placeholder: {
    ProgressView()
}

Lists

visionOS List views have built-in glass-compatible styling. Do NOT add custom glass backgrounds to list rows — this creates glass-on-glass rendering where text becomes invisible.

// CORRECT — let the system handle list row backgrounds
List {
    Section("General") {
        NavigationLink("Profile") { ProfileView() }
        Toggle("Notifications", isOn: $notifications)
    }
}
.listStyle(.insetGrouped)
// BANNED — glass on list rows causes invisible text
List {
    ForEach(items) { item in
        ItemRow(item: item)
            .listRowBackground(                         // NO
                RoundedRectangle(cornerRadius: 12)
                    .fill(.clear)
                    .glassBackgroundEffect()             // glass-on-glass = invisible text
            )
    }
}
.scrollContentBackground(.hidden)                       // NO — removes default list contrast

Key rules for Lists on visionOS:

Empty States

ContentUnavailableView(
    "No Results",
    systemImage: "magnifyingglass",
    description: Text("Try a different search term")
)

NOT Available on visionOS

Rules

  1. NEVER use opaque background colors on windows or main containers — use glass
  2. Use .glassBackgroundEffect() for custom container backgrounds (sidebars, cards, panels) — but NEVER on list rows
  3. NEVER use .scrollContentBackground(.hidden) or .listRowBackground() with glass — creates invisible text
  4. Use .listStyle(.insetGrouped) for Lists — system handles row styling
  5. ALL interactive elements MUST have .hoverEffect() for eye tracking
  6. Use system vibrancy (.primary, .secondary, .tertiary) for text — not AppTheme color tokens
  7. Limit AppTheme accent colors to buttons and small decorative elements only
  8. Use .buttonBorderShape() for spatial-appropriate button shapes
  9. Use RealityView for interactive 3D, Model3D for display-only 3D
  10. Ornaments for supplementary controls attached to windows
  11. ONE .borderedProminent per visible area
  12. Minimum touch target: 60x60 points for comfortable spatial interaction
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.