React Chat UI
A React chat UI for one conversation: bubbles grouped by sender, sticky day labels, replies, reactions, photos and typing.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/chat.jsonRiya S.
Online
Up and Down arrows move between messages. Enter shows actions, R replies, E edits your own message.
ChatThreadTypingDotsEmojiPickerChatComposerImageLightbox- +5 more
- +2 more
Direct chat
Send a message and watch the ticks: sending, sent, delivered, read; then Riya types and replies. Your third message fails: retry it. Hover a message for the toolbar, right-click (or long-press) for every action, or use the keyboard: ↑ ↓ between messages, Enter for actions, R to reply, E to edit. ↑ in an empty composer edits your last message.
Riya Sharma
Online
Up and Down arrows move between messages. Enter shows actions, R replies, E edits your own message.
import { ChatThread } from "@/components/sheenui/chat/chat-thread";
import { type ChatConversation, type ChatDraft, type ChatMessage, type ChatParticipant } from "@/components/sheenui/chat/types";
// Package build (after the first npm release, or a packed tarball): import { ChatThread, type ChatConversation, type ChatDraft, type ChatMessage, type ChatParticipant } from "@sheenui/theme";
// Your data layer: replace these with real data and handlers.
declare const chat: ChatConversation;
declare const people: ChatParticipant[];
declare const messages: ChatMessage[];
declare const firstUnreadId: string | undefined;
declare const hasOlder: boolean;
declare const loading: boolean;
declare function loadOlder(): void;
declare function startCall(): void;
declare function startVideo(): void;
declare function openContact(): void;
declare const api: {
send(chatId: string, draft: ChatDraft): void;
edit(id: string, text: string): void;
delete(id: string): void;
react(id: string, emoji: string, add: boolean): void;
retry(id: string): void;
markRead(chatId: string, lastId: string): void;
};
export function Example() {
return (
<ChatThread
conversation={chat}
messages={messages}
participants={people}
currentUserId="me"
firstUnreadId={firstUnreadId}
hasOlder={hasOlder}
loadingOlder={loading}
onLoadOlder={loadOlder}
onSend={(draft) => api.send(chat.id, draft)} // add it with status "sending", then update it
onEdit={(id, text) => api.edit(id, text)}
onDelete={(message) => api.delete(message.id)}
onReact={(message, emoji, add) => api.react(message.id, emoji, add)}
onRetry={(message) => api.retry(message.id)}
onRead={(lastId) => api.markRead(chat.id, lastId)}
onCall={startCall}
onVideoCall={startVideo}
onInfo={openContact}
className="h-[40rem]"
/>
);
}Files to copy
22 folders · 37 files · 4 packages
- From
theme/src/ components/chat/{chat-thread.tsx, composer.tsx, message-row.tsx, chat-parts.tsx, emoji-picker.tsx, emoji.ts, format.ts, hooks.ts, icons.tsx, labels.ts, message-parts.tsx, toolbar-store.ts, types.ts}components/alert-dialog/components/avatar/components/button/components/chat/thread/components/context-menu/components/description-list/components/dialog/components/drawer/components/file-upload/file-utils.tscomponents/input/components/kbd/components/menu/components/popover/components/skeleton/components/spinner/components/status-icons/components/tooltip/hooks/{use-controllable.ts, use-direction.ts, use-latest.ts, use-magnetic.ts, use-media-query.ts, use-preferences.ts}motion/{gate.ts, presets.ts, tokens.ts}lib/{cn.ts, field-size.ts, form.ts, glide-highlight.tsx, heading.ts, ime.ts, initials.ts, modal-flag.ts, modal-tab-trap.ts, popup-a11y.ts, popup-motion.ts, state-light.tsx, uid.ts, warn-once.ts}styles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/chat.jsonRegistry item: chat. The styles need the Tailwind v4 glass UI setup.- Packages
pnpm add @base-ui/react clsx motion tailwind-merge
Group chat
Sender names and avatars on the first message of each run, system notes, a four-photo grid with “+2”, and reactions from several people.
import { ChatThread } from "@/components/sheenui/chat/chat-thread";
import { type ChatDraft, type ChatMessage, type ChatParticipant } from "@/components/sheenui/chat/types";
// Package build (after the first npm release, or a packed tarball): import { ChatThread, type ChatDraft, type ChatMessage, type ChatParticipant } from "@sheenui/theme";
// Your data layer: replace these with real data and handlers.
declare const messages: ChatMessage[];
declare const people: ChatParticipant[];
declare function send(draft: ChatDraft): void;
declare function react(message: ChatMessage, emoji: string, add: boolean): void;
export function Example() {
return (
<ChatThread
conversation={{ id: "design", kind: "group", title: "Design Crew 🎨", participantIds: ["me", "riya", "mei", "arjun"] }}
messages={messages}
participants={people}
currentUserId="me"
onSend={send}
onReact={react}
/>
);
}Props
ChatLabels keys and English defaults (140)
ChatComposer props
DeliveryStatus props
EmojiPicker props
ImageLightbox props
Keyboard
Accessibility
- Each row is an article named by a spoken summary (sender, text, time, delivery state); the header names the chat and presence is written in words.
- Delivery state, reactions and typing are spoken in a polite live region; the "Jump to latest" button and composer controls have names.
- Targets are 44 px on touch screens, text is 16 px so iOS does not zoom, and forced colors give bubbles real borders.
All exports on this page
ChatComposer— The message field: grows with its text, emoji picker, attachments with thumbnails, reply and edit bars, and a send button.ChatThread— One conversation: header, the message log and the composer.DeliveryStatus— sending (clock) → sent (✓) → delivered (✓✓) → read (✓✓, coloured), failed (!).EmojiPicker— A compact emoji picker: search, category shortcuts and a grid.ImageLightbox— Full-size photos in a dialog: Left / Right (and swipe) between them, a counter and a download link.TypingDots— Three dots in a wave.defaultChatLabels— The English ChatLabels every chat component starts from; resolveChatLabels merges a partial override over them.
When to use the chat view
- Use it as a message thread for the main pane of a messaging app, with bubbles grouped by sender, day labels, a New messages line, replies, reactions, photos, files and delivery ticks.
- Use it for a customer support console, where agents see typing indicators, failed messages with Retry and a message list that loads earlier messages when the reader reaches the top without losing their place.
- Use onSend, onEdit, onDelete and onReact to connect your backend; append the new message at once with status sending so the ticks can move from sending to sent, delivered and read.
- Skip it when you need a one-shot AI prompt and answer layout; AI chat block suits a streaming assistant, and Popover chat already wraps this view for a corner support widget.
- Pair it with Chat list to pick conversations, Avatar for senders, and AlertDialog behavior already used for confirming delete.
Frequently asked questions
Related pages
67 components pages in all: browse them on All components.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .