Add the Nook "Avatar" component to this project, exactly as Nook ships it.
A user image with a text fallback while loading or when it fails.
Steps
1. Check for `nook.json` in the project root. If it is missing, run `npx nook-ui@latest init` first (React or Next.js with Tailwind CSS v4). It adds the Nook tokens, the theme and `cn()`.
2. Run `npx nook-ui@latest add avatar`. It writes `components/ui/avatar.tsx` together with everything the component needs. Do not write the component from memory.
3. If you cannot run commands, fetch http://localhost:3000/r/avatar.json, write every entry of `files` to the path it names, install the packages in `dependencies`, and repeat for each name in `registryDependencies`.
4. Use it where I ask. Start from this example:
```tsx
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
export default function AvatarDefault() {
return (
);
}
```
API
- `Avatar`: The circle container.
- `status` (`"online" | "away" | "busy" | "offline"`): Shows presence in a corner mark. It is also written for screen readers.
- `AvatarImage`: The image.
- `src` (`string`): Image URL.
- `alt` (`string`): Alternative text.
- `AvatarFallback`: Initials or an icon shown when there is no image.
- `delay` (`number`): Milliseconds to wait before showing, to avoid a flash.
- `AvatarGroup`: Overlaps several avatars and rings each one so they read apart.
- `...props` (`React.HTMLAttributes`): Everything the native element accepts, such as `id`, `aria-*` and event handlers.
Rules
- Colors, radii, shadows and motion come from Nook tokens and classes such as `bg-primary`, `text-muted-foreground`, `border-border`, `rounded-lg` and `h-control`. Never hard-code them.
- Do not restyle or simplify the file. Change how it looks through `className`, its props and the theme.
- It must keep working with the keyboard, in light and dark mode, and in the sharp, soft and bold styles.
- Accessibility: Always set `alt` on the image. Use `alt=""` when the person's name is shown next to the avatar.
Done when the component renders like the example in light and dark mode and the project type-checks.