Animated boxes
Updated 2026-10-12
Every Ghosty box is a TV-headed robot: its face says what it is doing (asleep, listening, working, failing), it follows the mouse and hops when clicked. It is the same one you see in Space boxes, and we publish it as a free package (MIT) so you can use it in your own pages and apps: @ghostystudio/boxes.
Install
It works in plain HTML and in any framework: it is a custom element. React gets two components: <RobotHead> (one box) and <GhostyBoxes> (the summary row). They ship with "use client", so in Next.js (App Router) you can use them as they are inside a Server Component. Every example below has a React tab.
States
What the box is doing. Each state has its own face, motion and light.
Shapes
Seasonal ones too: tree (Christmas) and pumpkin (Halloween).
Screen
face picks what it shows: eyes, a terminal or nothing. With the terminal, screen-icon adds an icon: mail, inbox, build, ci, preview, desktop or web (register your own with registerScreenIcon).
Colours, themes and finishes
A theme paints the box with one word; anything you set by hand wins over it. color is the shell, trim-color the ears and screen-color the LEDs. texture changes the finish and wear (0–1) adds wear and tear.
Your own theme: registerTheme('mybrand', { color: '#…', trimColor: '#…', screenColor: '#…' }), then theme="mybrand".
A summary row you reorder by dragging
<ghosty-boxes> is the summary row: title, counter, one box per item with its name, state and dots, and free slots switched off. Grab a box: it lifts, swings and smiles; drop it and it lands with a hop. Keyboard too: Alt + ← / →.
Data can also come from code, and the new order comes back in an event:
Each item has id, name, and optional label, tone (work, talk, error, sleep, calm), dots ({ on, cap }), off (a fixed free slot), group (it only moves within its group) and head (its box's props). The card's colours come from CSS variables on .gbx: --gbx-bg, --gbx-border, --gbx-fg, --gbx-muted, --gbx-work, --gbx-talk, --gbx-error, --gbx-dot, --gbx-radius.
Box detail, hover card and the big group
React also ships a box's detail sheet (the modal Space boxes opens), the card that shows on hover and a group opened big. Everything goes in as data: you decide what to say and the package draws it. lookFor(id) gives an agent's colour, shape and seed, so the same agent looks the same in your app and in Ghosty.
BoxDetail: title, chips, a coloured state (work,talk,waste,error,calm,sleep), a hint, rows, conversation dots and who it talks to (chats). Actions go in as children. Esc or a click outside closes it. Dark by default;lightmakes it light.BoxHoverCardwithuseHoverCard(): stays inside the window and waits a moment before closing, so you can move into it.BoxesSheet: a group opened big; put a<GhostyBoxes>inside and it reorders by dragging.
<ghosty-box> attributes
In React they are the same props in camelCase (trimColor, screenIcon, floorShadow), with numbers and flags in braces (size={96}, antenna={false}). It respects prefers-reduced-motion. Attribute changes show up instantly.
The robot is by Fayaz Ahmed (MIT), with states, shapes, screens, themes and finishes added by Ghosty.