You can install the SDK via Node Package Manager, Performant Bun, PNPM, NPM or Yarn.
The SDK requires Node.js version 17.02+, please upgrade if your package
manager warns about it.
pnpm i @avatechai/avatars
yarn add @avatechai/avatars
Below is a simple example of how to display a generated avatar using the SDK.
import { useAvatar } from '@avatechai/avatars/react'
export default function App() {
const { avatarDisplay } = useAvatar({
// Avatar State
avatarId: 'af3f42c9-d1d7-4e14-bd81-bf2e05fd11a3',
// Style Props
scale: 1,
})
return <>{avatarDisplay}</>
}
import { useAvatar } from '@avatechai/avatars/react'
export default function App() {
const { avatarDisplay } = useAvatar({
// Avatar State
avatarId: 'af3f42c9-d1d7-4e14-bd81-bf2e05fd11a3',
// Style Props
scale: 1,
})
return <>{avatarDisplay}</>
}
import { useAvatar } from '@avatechai/avatars/react'
import { defaultAvatarLoaders } from '@avatechai/avatars/default-loaders'
export function App() {
const { avatarDisplay } = useAvatar({
// Avatar State
avatarId: 'af3f42c9-d1d7-4e14-bd81-bf2e05fd11a3',
// Loader + Plugins
avatarLoaders: defaultAvatarLoaders,
// Style Props
scale: 1,
})
return <>{avatarDisplay}</>
}
Demo