React Chat UI: Conversation & Input Components
Claude-style React chat UI components: message bubbles, thinking collapse, composer, / and @ commands, model switcher, MCP tool card. 6 live demos.
Conversation and input are the core of the Claude chat interface. This React chat UI page covers message bubbles, the collapsible thinking process, the composer, slash commands and @ mentions, the model switcher, and the authorization card for MCP tool calls. The 6 demos on this page correspond to Chapter 3 of the v1 handbook; the composer radius uses the 2.0 value of 14px.
Key values
| Item | Value | Source |
|---|---|---|
| Composer radius | 2.0 comfortable 14px · compact 12px (20px in 1.x) | v2/03 §3.3 |
| Thinking expansion | CSS Grid 0fr → 1fr | v1/03 §3.2 |
| IME composition guard | ignore Enter within 500ms after compositionend | v1/03 §3.3.2 |
| MCP authorization buttons | Allow once / Always allow / Deny | v1/03 §3.5 |
Message bubbles
User messages use a bubble; assistant replies have no background and sit directly on the canvas.
export interface Config {
port: number;
host?: string;
}Thinking collapse panel
While the model is thinking it shows a timer and a three-dot wave; when it finishes, the panel collapses and can be opened to read the full text.
Composer
The composer is the most rounded element in the interface; 2.0 tightens its radius from 20px to 14px.
Command and mention input
Type / to open commands and @ to reference files; pressing Enter while choosing a candidate in a Chinese (or other CJK) input method does not send the message by mistake.
Model switcher and token gauge
Next to the model dropdown is a ring gauge that shows progress by context usage and separates cache reads from cache writes.
MCP tool decision card
Before an agent calls a tool through MCP, an authorization card appears. Its status goes from awaiting approval to running, then to success, denied or failed.
{
"path": "~/projects/app/README.md",
"encoding": "utf-8"
}How do I use these React chat components in a project?
Copy the matching file from code-examples/ and import cds-theme.css. For example:
import { ChatComposer } from './ChatComposer';
<ChatComposer onSendMessage={(text) => console.log(text)} />Note: some labels inside the demo components themselves are still in Chinese (they come straight from the repository's components); the behavior and specs are the same.
Sources
The specs on this page come from v1 Chapter 3 and v2 Chapter 3 of the handbook, the component code comes from the repository's code-examples/, and browser events and protocols follow their official documentation.
- open-claude-ui · code-examples/:
ChatMessageBubbles.tsx,ThinkingAccordion.tsx,ChatComposer.tsx,RichComposerWithMentions.tsx,ModelSwitcherWithTokenGauge.tsx,McpToolDecisionCard.tsx. - MDN: compositionend event: the event the IME composition guard listens for.
- MDN: grid-template-rows: the property behind the
0fr → 1frthinking expansion. - Model Context Protocol specification: Tools: the official definition of MCP tool calls.
- React docs: API reference: the React APIs these chat UI components are built on.
When Chinese, Japanese, or Korean users press Enter on an IME candidate floating list to confirm phonetic characters, the unfinished message is erroneously sent.
— open-claude-ui README · CJK IME Composition Double-Interlock Guard
Related pages
- Atomic components (Chinese)
- Motion & light (Chinese)
- v1 Chapter 3 (Chinese)
- Claude Colors & Design Tokens
- All AI chat interface components