MascotPanel lets people design their own Mascot. It edits a MascotDesign, a plain JSON value your app stores (a database column, a URL, local storage) and spreads back onto <Mascot /> with mascotDesignProps. It comes from @once-ui-system/blocks, next to StylePanel, and works the same way.
MascotDesign holds no React nodes or functions, so it fits a jsonb column as it is. Read every stored or AI-written design through parseMascotDesign: it never throws, drops what it does not know, clamps numbers to their range and only keeps colors and paths that look like colors and paths.
Without value the panel keeps its own state from defaultValue, and with storageKey it remembers it in the browser.
- Body: color (brand, accent, neutral or your own), roundness, width and surface.
- Eyes: shape, size, spacing, height and an optional color.
- Face: mouth, brows and cheeks.
- Accessories: the nine built-ins as tiles, several at once, and one optional color.
- Working: what it turns into while it thinks: nothing, the cube or the d20, with its sides and face.
- Motion: its personality.
The pickers for surface, eye shape, mouth, accessories, state and mood are one scrolling row of tiles, each showing your mascot with that option on, so people see what they pick. Arrow keys move between the tiles.
The preview tries every state and mood, kawaii ones included. That part is never saved.
size="s" makes it denser: tighter rows and groups, smaller tiles and a smaller preview, as on StylePanel.
The preview's "more" menu, in its top right corner, holds Randomize, Reset and the free exports: Copy JSON, Copy JSX, and the flat mascot as an SVG or PNG file, drawn in the browser. Pass exports to add your own menu items after them; they read the design with useMascotPanel().
Like StylePanel, the panel is a plain composition of its parts. Use MascotPanelRoot with only the sections you need, and hide single rows with rows:
visibility does the same on the whole panel, preview moves the preview (side, top or none), and labels translates every string it shows or announces.