npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@three-ws/react

v1.0.1

Published

React components for embedding three.ws 3D AI agents

Downloads

231

Readme

@three-ws/react

React components for embedding three.ws 3D AI agents. Drop a walking 3D avatar into any React app in two lines — no Three.js, no WebGL setup, no build config. The 3D runtime lives inside three.ws and renders through a sandboxed iframe.

npm install @three-ws/react

Quick start

import { Agent3D } from '@three-ws/react';

export default function Page() {
  return <Agent3D agentId="your-agent-id" controls="joystick" />;
}

That's it. <Agent3D> renders a responsive 3D viewer (default 100% × 600px) that loads your agent's avatar and lets visitors walk it around.

WalkEmbed is exported as an alias of Agent3D for backwards compatibility:

import { WalkEmbed } from '@three-ws/react';

Lifecycle & imperative control

import { useRef } from 'react';
import { Agent3D } from '@three-ws/react';

export function Avatar() {
  const ref = useRef(null);

  return (
    <Agent3D
      ref={ref}
      agentId="your-agent-id"
      controls="joystick"
      width={480}
      height={720}
      onLoad={() => console.log('scene ready')}
      onError={(err) => console.error(err)}
    />
  );
}

// Later, drive the live embed:
ref.current.setMotion('walk');     // 'idle' | 'walk' | 'run'
ref.current.setAvatar('av-1234');  // swap avatar live
ref.current.setSpeed(1.5);         // walk-speed multiplier (0.3–3)
ref.current.narrate('Hi there!');  // speech bubble over the avatar
ref.current.setEnvironment('studio');
ref.current.resetPose();

Props

| Prop | Type | Default | Description | |---------------|---------------------------------------|----------------|--------------------------------------------------------| | agentId | string (required) | — | The three.ws agent ID — its avatar is rendered. | | avatarId | string | — | Override the agent's default avatar. | | controls | "joystick" \| "keyboard" \| "none" | "joystick" | Movement controls. | | background | string | transparent | "transparent" or a hex color like "#1b1b1b". | | environment | string | "studio" | Environment preset. | | autoplay | boolean | false | Autoplay an idle walk loop. | | ground | boolean | true | Show the shadow ground disc. | | orbit | boolean | true | Allow orbit drag on desktop. | | speed | number | 1 | Walk-speed multiplier (0.3–3), applied once ready. | | width | string \| number | "100%" | Container width (number → px). | | height | string \| number | "600px" | Container height (number → px). | | onLoad | () => void | — | Fires when the 3D scene is ready. | | onError | (err: Error) => void | — | Fires on load failure. | | className | string | — | CSS class on the wrapper <div>. | | style | React.CSSProperties | — | Inline styles on the wrapper <div>. | | title | string | three.ws title | Accessible title for the underlying iframe. |

Imperative handle (via ref)

| Method | Description | |---------------------------|----------------------------------------------| | sendMessage(msg) | Post an arbitrary message to the embed. | | setAvatar(id) | Swap the rendered avatar live. | | setMotion(motion) | "idle" \| "walk" \| "run". | | setEnvironment(env) | Switch the environment preset live. | | setSpeed(value) | Set the walk-speed multiplier (0.3–3). | | narrate(text) | Show a speech bubble above the avatar. | | resetPose() | Recenter the avatar on the ground. | | iframe | The underlying HTMLIFrameElement (or null).|

Security

Inbound postMessage events are accepted only from the three.ws origin and only from this component's own iframe — messages from any other origin or window are ignored. This is enforced regardless of which onLoad/onError handlers you pass.

TypeScript

Types ship with the package (Agent3DProps, Agent3DHandle, Agent3DControls). No @types install needed.

Requirements

react and react-dom >= 17 are peer dependencies — the package never bundles its own React.

Links

License

MIT © three.ws