Characters

Pet

A soft little square that shows its mood with its eyes alone, and the eyes follow the pointer.

Preview

Installation

Terminal
npx @usefluid/cli add pet

Usage

Pet.tsx
import { Pet } from "./Pet";

<div style={{ width: 96, height: 96 }}>
  <Pet mood={saved ? "happy" : "idle"} label="Acme helper" />
</div>

Colours

The body is drawn in currentColor, and the eyes are holes cut out of it, so they show whatever is behind the pet.

Pet
<Pet color="#ff5a1f" />

<Pet color="var(--fluid-accent)" />

<div style={{ color: "#16a34a" }}>
  <Pet color="currentColor" />
</div>

Without color, the pet wears --fluid-accent, so changing that variable recolours every pet that has no colour of its own. To change the eyes, change the background behind the pet.

API reference

PropTypeDefaultDescription
mood"idle" | "happy" | "surprised" | "sleepy" | "curious""idle"Tie it to real events: done, error, waiting.
stillbooleanfalseNo breathing or blinking.
followbooleanfalseEyes follow the pointer, and on touch look at each tap.
look{ x, y }—Where the eyes look, from -1 to 1, when not following.
labelstring—Accessible name. Without it the pet is decorative.
colorstring--fluid-accentAny CSS colour or variable.
classNamestring—It fills its box.

Keyboard and screen readers

Decorative unless labelled. Never the only way information is given.

Notes

It breathes and blinks softly; pass still where nothing should move on its own. Happy hops twice. Change BODIES and FACES in the file to make it your own.

Every colour comes from the --fluid-* variables, and the piece is yours to change.

How it is made

The body is a square with soft corners, a single contour, and the morph engine takes one mood's silhouette to the next. The eyes are cut-outs in a mask, each one an oval and a stroke on springs: as one shrinks the other grows, so an open eye turns into a smile or a sleepy line without a cut. That is why the face never tears. The drop above the head floats like a splash, it blinks by itself, and everything stops with reduced motion.

For your agent

For your agent

Add Pet to my project with the Fluid library. Create my product's mascot with Pet, in my brand colour, and use the moods to react to what people do. Read my project first. Use my logo, my colours and my font through the --fluid-* variables. Keep 44px touch targets, visible focus and reduced motion. If I have no SVG logo, ask before making one up.