Skip to content
  • Web

Web Entry Point

Use the browser compatibility entry for an explicitly web-only consumer.

Examples

Quick start

nayan-ui/web
import { warmUpEngine } from 'nayan-ui/web';

export async function preload() {
  await warmUpEngine();
}

Render a game in a browser-only client component

nayan-ui/web
'use client';

import { GameView, useWorld } from 'nayan-ui/web';

export function BrowserScene() {
  const world = useWorld(16, (scene) => { scene.spawn({ mesh: 'cube', color: '#3b82f6' }); });
  return world ? <GameView source={world} style={{ height: 220, width: '100%' }} /> : null;
}
Related guide

Tags