Bot avatar
Animated subagent avatars from bot-avatars.
Size it with size, never with CSS, and leave room around it: it paints on a canvas one and a half times its box, and hops above it while working. FREE_BOT_TYPES lists the seven body types the system uses.
Types
"use client"
import { BotAvatar, FREE_BOT_TYPES } from "@/components/ui/bot-avatar"
export default function BotAvatarTypes() {
return (
<div className="flex flex-wrap items-center justify-center gap-6">
{FREE_BOT_TYPES.map((type, index) => (
<BotAvatar key={type} type={type} size={48} seed={index / FREE_BOT_TYPES.length} />
))}
</div>
)
}
States
Idle
Working
Sleeping
import { BotAvatar } from "@/components/ui/bot-avatar"
const states = [
{ state: "default", label: "Idle" },
{ state: "working", label: "Working" },
{ state: "sleeping", label: "Sleeping" },
] as const
export default function BotAvatarStates() {
return (
<div className="flex flex-wrap items-end justify-center gap-10">
{states.map(({ state, label }) => (
<div key={state} className="flex flex-col items-center gap-3">
<BotAvatar type="flower" state={state} size={48} aria-hidden />
<span className="text-sm text-muted-foreground">{label}</span>
</div>
))}
</div>
)
}
Sizes
24
32
48
64
import { BotAvatar } from "@/components/ui/bot-avatar"
export default function BotAvatarSizes() {
return (
<div className="flex flex-wrap items-end justify-center gap-8">
{[24, 32, 48, 64].map((size) => (
<div key={size} className="flex flex-col items-center gap-3">
<BotAvatar type="star" size={size} aria-hidden />
<span className="text-sm text-muted-foreground tabular-nums">{size}</span>
</div>
))}
</div>
)
}
Beside a status
Release notes check
Idle
"use client"
import { useState } from "react"
import { BotAvatar } from "@/components/ui/bot-avatar"
import { Button } from "@/components/ui/button"
export default function BotAvatarBesideAStatus() {
const [running, setRunning] = useState(false)
return (
<div className="flex w-full max-w-sm items-center gap-3">
<BotAvatar type="ghost" size={32} state={running ? "working" : "default"} aria-hidden />
<div className="min-w-0 flex-1">
<p className="truncate font-medium">Release notes check</p>
<p role="status" className="text-sm text-muted-foreground">
{running ? "Working" : "Idle"}
</p>
</div>
<Button variant="outline" onClick={() => setRunning(!running)}>
{running ? "Stop" : "Start"}
</Button>
</div>
)
}
Installation
npx shadcn@latest add @khaeli/bot-avatarbunx --bun shadcn@latest add @khaeli/bot-avatarInstall @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.
Installs with
- npm packages
- bot-avatars ^0.2.2
Accessible name
- Alone, the canvas is an image named from its type and state, such as
Flower bot, idle. Passaria-labelto name it yourself. - Beside a text status, hide it with
aria-hiddenso the status is read once. - With reduced motion it draws the still pose of its state and runs no animation.
Registry JSON
The item as the shadcn CLI reads it, with every file it ships: https://ui.khaeli.com/r/bot-avatar.json