Menu

Pet Picker

Let visitors click the pet and choose their own.

Install

Pulls in web-pet and the shadcn Popover if you do not have them yet.

bunx --bun shadcn@latest add https://webpets-flame.vercel.app/r/pet-picker.json

Usage

import { PetPicker } from "@/components/pet-picker";

<PetPicker defaultAnimal="deno" hoverMessage="click me" />

The pet is clickable. The menu lists every animal in the manifest, the choice is saved in localStorage, and None hides the pet behind a small trigger. Ship the GIFs for every animal you offer.

<PetPicker
  animals={["deno", "fox", "chicken", "totoro"]}
  colors={{ fox: "white" }}
  defaultAnimal={null}
  storageKey="my-site:pet"
/>

Props

PropTypeDefaultDescription
animalsstring[]allAnimals offered in the menu.
colorsRecord<string, string>first colorColor to use per animal.
defaultAnimalstring | nullanimals[0]Shown before a choice is made. null shows only a small trigger.
storageKeystring | null"webpet:animal"Where the choice is saved in localStorage. null disables it.
onChange(animal: string | null) => void—Fires on every pick.
…WebPetProps—Everything else is passed to WebPet.