--- title: ChatGPT Clone Example description: Open-source ChatGPT clone built in React with assistant-ui — centered welcome composer, high-contrast user bubbles, tooltipped controls, and full assistant action bar. --- import { ChatGPT } from "@/components/examples/chatgpt";
## Overview The ChatGPT Clone demonstrates how to customize assistant-ui to match OpenAI's ChatGPT interface. This version mirrors the current chatgpt.com layout: a centered welcome composer, tooltipped attachment/dictation/voice controls, high-contrast user bubbles with Copy + Edit actions, and an always-visible assistant action bar with thumbs, share, speak, reload, and more. ## Features - **Theme-Aware**: White light mode (`#ffffff`) and black dark mode (`#000000`) with ChatGPT-style `#212121` composer surfaces - **Centered Empty State**: "Where should we begin?" heading + composer rendered together above the viewport center - **Tooltipped Composer Controls**: Add attachment, Dictate, and voice-mode buttons use ChatGPT's circular controls and hover tooltips - **Four-State Primary Action**: Cancel (running), StopDictation (recording), Send (typing), Dictate + voice mode (idle) - **Assistant Action Bar**: Always visible — Copy, Good response, Bad response, Read aloud, Share, Regenerate, More - **User Bubble**: Right-aligned high-contrast bubble with Copy + Edit actions below on hover - **Sticky Footer**: Composer + "ChatGPT can make mistakes" disclaimer at the bottom of the chat ## Quick Start ```bash npx assistant-ui add thread ``` ## Code The ChatGPT clone splits into an `EmptyState` and a sticky chat layout. The same composer shell is shared by both: ```tsx import { AuiIf, ThreadPrimitive, ComposerPrimitive, ActionBarPrimitive, } from "@assistant-ui/react"; import { PlusIcon } from "lucide-react"; import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button"; export const ChatGPT = () => ( s.thread.isEmpty}> !s.thread.isEmpty}>

ChatGPT can make mistakes. Check important info.

); const Composer = ({ placeholder }: { placeholder: string }) => (
); ``` ### Four-State Primary Action ```tsx s.thread.isRunning}> !s.thread.isRunning && s.composer.dictation != null}> !s.thread.isRunning && s.composer.dictation == null && !s.composer.isEmpty } > !s.thread.isRunning && s.composer.dictation == null && s.composer.isEmpty } > ``` The conditions are mutually exclusive in priority order (`Cancel > StopDictation > Send > Dictate/voice mode`) so dictation can be paused even when transcribed text is in the composer. ### User Bubble and Actions ```tsx
``` ### Color Palette | Element | Light | Dark | |---------|-------|------| | Background | `#ffffff` | `#000000` | | Composer surface | `#ffffff` | `#212121` | | Composer border / edge | `#e5e5e5` | `transparent` + inset white edge | | Primary text | `#0d0d0d` | `#ececec` | | Muted text | `#5d5d5d` | `#afafaf` | | User bubble | `#0d0d0d` (white text) | `#ececec` (`#0d0d0d` text) | | Action icon | `#5d5d5d` | `#cdcdcd` | | Icon hover background | black at 7% | white at 15% | | Send / voice button | `#0d0d0d` (white icon) | `#ffffff` (black icon) | ### Styling Details - **Composer**: `rounded-[28px]` with a thin light-mode border, dark `#212121` surface, and an inset dark-mode edge - **Empty Layout**: 24px/400 heading + composer raised above center; no avatar - **Composer Buttons**: 36px circular controls with hover tooltips and background-only hover states - **Assistant Action Bar**: 32px controls, 8px radius, zero gap, background-only hover, and tooltips on every action - **User Bubble**: `rounded-[22px]`, 70% max width, high-contrast theme colors, Copy + Edit actions below on hover ## Source