Menu

Props

Every prop the component accepts.

Signature

Only animal is required. Everything else has a sensible default.

components/web-pet.tsx
type WebPetProps = {
  animal: string;
  color?: string;
  position?: "fixed" | "absolute";
  speed?: number;
  scale?: number;
  followMouse?: boolean;
  hoverMessage?: string;
  speech?: { maxWidth?: number; offsetY?: number };
  mediaBaseUrl?: string;
  zIndex?: number;
  style?: CSSProperties;
  behavior?: Partial<PetBehavior>;
};

Reference

PropTypeDefaultDescription
animalstringRequiredFolder name under media.
colorstringfirst availableColor variant.
position"fixed" | "absolute""fixed"Roam the viewport or the nearest positioned parent.
speednumberper animalPixels per tick. 8 ticks per second.
scalenumber0.5Multiplier on the 100 px sprite.
followMousebooleanfalseChase the cursor instead of wandering.
hoverMessagestring—Speech bubble shown near the cursor.
speech{ maxWidth?, offsetY? }{ 160, 0 }Bubble width and vertical nudge.
mediaBaseUrlstring"/media"Where the GIF folders are served from.
zIndexnumber9999Stacking order.
styleCSSProperties—Merged onto the wrapper.
behaviorPartial<PetBehavior>—Tuning knobs. See Behavior.