Skip to content
Blobz docs

CustomAvatar

Render a complete serializable face definition with semantic choice names.

CustomAvatar does not use a name to choose any facial feature. Every choice is explicit, readable, and serializable.

import {
  CustomAvatar,
  type CustomAvatarValue,
} from "@blobz/react/custom";

const definition: CustomAvatarValue = {
  type: "custom",
  version: 1,
  frame: "circle",
  palette: ["#ffffff", "#12b76a"],
  choices: {
    shape: "leaf",
    eyes: "distorted",
    look: "centre",
    eyeSpacing: "medium",
    mouth: "wide smile",
    brows: "quizzical",
    mirrored: false,
    faceAngle: 2,
    bodyTilt: -4,
    facePosition: { x: 1, y: 0 },
  },
};

<CustomAvatar definition={definition} size={96} />;
Custom blob avatar

Choice catalogue

PropertyAllowed values
shapeeared, lopsided, pillow, star, ghost, pebble, squircle, pentagon, flower, clover, sun, fuzz, sparkle, pill, quarter, round, leaf, soft triangle, cloud, drop, bean
eyesbig, dots, sleepy, happy, wink, squint, distorted, grumpy, uneven, oval, side-eye, crossed, shocked, peep wink
lookcentre, left, right, up, down
eyeSpacingclose, medium, wide
mouthsmile, flat, open, frown, oh, smirk, tongue out, grin, buck teeth, wobbly, wide smile
browsnone, raised, angry, worried, flat, quizzical, high, tilted, unibrow
mirroredboolean
faceAngleInteger from −12 to 12
bodyTiltEven integer from −14 to 14
facePosition.xInteger from −2 to 2
facePosition.yInteger from −1 to 1

Invalid semantic names or geometry throw a descriptive RangeError or TypeError. Validate persisted JSON at your application boundary before rendering untrusted values.

CustomAvatar accepts the same size, alt, style, image props, and image ref behavior as Avatar. Its rendered image has data-blobz-source="custom" and defaults to the alt text Custom blob avatar.

Theme

On this page