Add the Nook "Chat" component to this project, exactly as Nook ships it.
Message bubbles for a conversation, with a typing indicator.
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 chat`. It writes `components/ui/chat.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/chat.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 } from "@/components/ui/avatar";
import { Chat, ChatBubble, ChatContent, ChatMessage, ChatMeta, ChatTyping } from "@/components/ui/chat";
export default function ChatDefault() {
return (
MC
Morning! Did the launch page copy get approved?
Maya, 9:41
Yes, legal signed off last night.
I only changed the pricing line, the rest is yours word for word.
Read 9:43
MC
);
}
```
API
- `Chat`: The conversation.
- `...props` (`React.HTMLAttributes`): Everything the native element accepts, such as `id`, `aria-*` and event handlers.
- `ChatMessage`: One turn.
- `side` (`"start" | "end"`, default "start"): `end` is for the person using the app.
- `ChatContent, ChatBubble, ChatMeta, ChatTyping`: The stack of bubbles, a bubble, the small line under it, and the typing indicator.
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: The conversation has role=log, so new messages are announced without stealing focus: name it with `aria-label`. Who is speaking comes from the text and the meta line, never from the side or the color alone.
Done when the component renders like the example in light and dark mode and the project type-checks.