Usage
@prepared911/ui-ai-elements provides conversation UI primitives built on @prepared911/ui-core and the AI SDK message model. Chat is the assembled block: one owner of spacing, in form factors selected by ChatVariant (Default for near-full-screen chat with a floating reflowing composer over the transcript, Annotation for the compact popover with flat turns and a stacked docked composer). Form factor is chosen explicitly — never inferred from width — so both form factors can share a width and still use different chrome.
Individual elements (Message, PromptInput, Conversation, Response, CodeBlock, …) compose inside Chat or stand alone. CodeBlock is the fenced-code surface: language label, optional copy control, and Shiki dual-theme highlighting (github-light / github-dark-dimmed). Response routes markdown fences through CodeBlock; Tool uses it for JSON input and output.
Conversation keeps a bottom-pinned transcript attached as content streams and reconciles its scroll-button state when viewport or content geometry changes. User scrolling still releases the pin. Response renders blockquote prose with body-small typography so quoted context remains visually subordinate to the surrounding body-large response.
Chat whenever you need a transcript plus composer with consistent gutters across products (annotation popover, full-page assistant).Response.Tool).Conversation / Message / PromptInput spacing — prefer Chat so form-factor chrome stays in one place (CHAT_VARIANT_CHROME).ShikiCode path; do not mount CodeBlock there for MDX.CodeBlock is display-only; use a product editor for write paths.`code` (styled by Response), not a full CodeBlock.ChatVariant.Annotation so the stacked docked PromptInput chrome fits the narrow popover.ChatVariant.Default so the composer floats over scrolling turns with a scrim that matches the nearest opaque parent background.prompt.chips for pinned context (files, records, tagged elements) above the typed area, with prompt.attach driving the leading add control when uploads are needed.prompt.chips — tagged page elements, files, records — so the chips persist across sends and never leak into the submitted text.prompt.onStop with status="streaming" so the trailing composer control becomes a Secondary stop button that aborts generation, matching Cursor / ChatGPT / Claude.Tool accordion.On this page