← lab

@three-ws/avatar/react

The React wrapper around the SDK. Imports Avatar, AgentAvatar, AvatarCreator, and useAvatar directly from /avatar-sdk/src/react.jsx. React is loaded from a CDN via an import map so this page works without a bundler step.

1. <Avatar> — light viewer

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

<Avatar src="/avatars/default.glb" alt="Default three.ws avatar" />
mounting React tree…

2. <AgentAvatar> — full runtime

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

<AgentAvatar src="/avatars/default.glb" />
waiting for SDK monolith…

3. <AvatarCreator> — declarative modal

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

<AvatarCreator open={open} onExport={blob => ...} onClose={() => setOpen(false)} />
click the button to open the three.ws Avatar Creator.

4. useAvatar(id) — hook

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

const { avatar, loading, error } = useAvatar(id);
enter a three.ws avatar id to fetch its record.