/

AI Components for React: Choose the Right Layer

A practical map of React components for AI products: composers, transcripts, tool calls, artifacts, voice, and the runtime each layer still needs.

Serafim Korablev
Serafim Korablev
@korablev

"AI components for React" can mean three different things: a styled prompt box, a message runtime that understands streaming and tools, or a complete product surface. Choosing the wrong layer is how a small assistant feature turns into a framework migration.

The useful way to choose is by responsibility. Start with the interface state you need, then decide whether you need a component, a runtime, or both.

The six components an AI surface actually needs

A composer. It handles a growing prompt, keyboard submission, attachments, a model or mode picker, and the switch from Send to Stop. v0 AI Chat by kokonutd is a compact assembled example; AI Chat Input by preetsuthar17 is easier to place inside an existing shell.

A transcript. A normal list is not enough once the last item changes several times a second. Chat Message List by jakobhoeg gives you the scrolling structure, but your application still has to preserve scroll position when the reader moves away from the newest answer.

Tool-call rows. Search, code execution, file reads, and API calls need a visible pending state, a result, and an error that belongs to the tool rather than to the whole answer. This is where a generic chat bubble stops being an AI component.

Citations. A citation is part of the answer, not decoration after it. Give it a stable link, a readable source label, and a place that does not move when more tokens arrive.

Artifacts. Generated code, images, tables, and documents need their own surface with actions that match the output. AI Chat Image Generation by gonzalo chalé shows why an image result needs a different layout from prose.

Voice controls. Voice adds recording, listening, speaking, interruption, and permission states. AI Assistant Interface by Rafael Porto is useful as a visual reference, but microphone permission and audio cancellation still live outside the component.

Component, runtime, or kit

A presentational component owns markup and local interaction. It is the right choice when AI is one feature inside a larger product and the surface should use the product's existing state, routing, and design tokens.

A message runtime owns the conversation model: message ids, partial assistant output, tool parts, attachments, cancellation, and regeneration. Use one when chat is a primary surface and those states would otherwise be rebuilt in several components.

A kit combines the two. It gets a coherent interface running quickly, but its message shape and composition rules become application architecture. That is a good trade when the AI surface is the product and an expensive one when it is a panel inside an existing dashboard.

LayerIt should ownIt should not own
React componentMarkup, styling, focus, local controlsProvider calls, secrets, persistence
Message runtimeStreaming state, message parts, tool lifecycleProduct layout and business permissions
Application backendAuthentication, models, tools, storage, limitsVisual state that belongs in the browser

The states to design before the happy path

The completed answer is the easiest state and the least useful test. Design these first:

Waiting for the first token. Keep the user's message visible and put the pending state where the assistant answer will appear. An overlay makes the whole product look blocked.

Streaming while the reader scrolls. Follow the bottom only while the reader is already there. Once they scroll up, stop moving the viewport and show a jump-to-latest action.

Stopped. Keep the partial answer and mark it as stopped. A person often presses Stop because the useful part has already arrived.

Tool failed. The failed search or API call should be retryable without discarding the rest of the answer.

Connection failed. Keep the user's prompt in the transcript and preserve the draft or attachment state. Vanishing input is worse than an explicit error.

Refused. A refusal is a valid model outcome, not a red application failure with a generic Retry button.

How to choose a React AI component

Read the component's boundary before its screenshot.

  1. Check whether it accepts your message data or brings its own store.
  2. Check whether streaming updates only the active message or re-renders the whole transcript.
  3. Check keyboard composition, focus-visible states, and a sentence-level live-region strategy.
  4. Check how it behaves without hover and with reduced motion.
  5. Check whether tool calls, attachments, and citations are real data slots or hardcoded demo rows.
  6. Check the files and dependencies the install writes before keeping them.

That last step matters with copy-owned components. The benefit is that the source becomes yours; the cost is that upgrades and accessibility fixes become yours too.

Where to start

SourceBest whenTrade-off
AI SDK and AI ElementsYou want streaming, structured message parts, and React UI built around the same modelThe message model becomes a stack choice
assistant-uiChat is a primary product surface and you want a ready conversation runtimeIt owns more of the interaction architecture
shadcn/uiYou need the primitive layer underneath the AI surfaceIt deliberately has no model runtime
21stYou want to compare and install individual React AI components with sourceComponents are presentational, so preview and review each one

If the product is mostly chat, start from a runtime and adapt the visuals. If AI is one feature inside an existing product, keep the product's state model and take the individual components you need.

Taking one

Every component page has a live preview and the source. Installing goes through the shadcn CLI against the 21st registry:

bash

The key comes from your 21st account and installs need a membership. The 21st MCP can search and install the same catalogue from Claude, Cursor, or Codex.

Browse AI chat components →

Frequently asked

What are AI components for React?
They are interface pieces shaped around model interactions: prompt composers, streaming transcripts, tool-call rows, citations, generated artifacts, voice controls, and the loading, stopped, refused, and failed states around them. They do not replace the model runtime or API call.
Do React AI components include the backend?
Usually not. A catalogue component gives you markup, styling, and local interaction. A runtime library can manage messages and streaming. Authentication, rate limits, persistence, tool execution, and provider calls still belong to the application backend.
Should I start with a full AI UI kit or individual components?
Use a kit when chat is the product and you want one message model across the composer, transcript, tools, and attachments. Use individual components when AI is one feature inside an existing product and the new surface has to inherit that product's layout and tokens.
What should I test before shipping a React AI interface?
Test slow first-token latency, cancellation, a dropped connection, long code blocks, attachments, keyboard-only input, screen-reader announcements, and a reader scrolling upward while a response streams. Those states expose more problems than the completed-answer screenshot.

Published

Sep 4, 2026

Read time

6 min

Tags

GuideAIReactComponents

Share