Skip to content

React Chat App Template

A complete React chat app template: the chat list and the open chat side by side, stacking into list then chat on narrow screens.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/chat-app.json

Chats

Riya Sharma
, Also, can you review the chat PR before that? 🙏, Pinned, 2 unread messages
Design Crew 🎨
, Riya: Thanks Mei 🙌, Pinned
Daniel Okafor
, typing…, 1 unread message
Weekend Trek ⛰️, Muted
, Ananya: Who's carrying the Maggi? 🍜, 14 unread messages
Priya Iyer
, You: Sent the invoice, let me know!, Delivered
Arjun Nair
, Draft: Can you send the specs
Sofia García
, ¡Gracias! See you on Friday 🎉
Family 🏡
, Vikram: Photo, 128 unread messages
Mei Lin
, You: That works 👍, Read
Lucas Moreau
, Merci beaucoup!
Ishaan Kapoor
, This message was deleted
Fatima Zahra
, You: Happy birthday Fatima! 🎂🎈, Read

Pick a chat

Choose a conversation from the list to read and reply.

Messenger

Open chats, send messages (replies arrive with typing and read receipts), pin or archive from a row's menu, and open the info panel from a chat's header. Narrow your window (or open this on a phone) to see the stacked layout.

Chats

Riya Sharma
, Also, can you review the chat PR before that? 🙏, Pinned, 2 unread messages
Design Crew 🎨
, Riya: Thanks Mei 🙌, Pinned
Daniel Okafor
, typing…, 1 unread message
Weekend Trek ⛰️, Muted
, Ananya: Who's carrying the Maggi? 🍜, 14 unread messages
Priya Iyer
, You: Sent the invoice, let me know!, Delivered
Arjun Nair
, Draft: Can you send the specs
Sofia García
, ¡Gracias! See you on Friday 🎉
Family 🏡
, Vikram: Photo, 128 unread messages
Mei Lin
, You: That works 👍, Read
Lucas Moreau
, Merci beaucoup!
Ishaan Kapoor
, This message was deleted
Fatima Zahra
, You: Happy birthday Fatima! 🎂🎈, Read

Files to copy

29 folders · 49 files · 4 packages
From theme/src/
  • blocks/chat-app.tsx
  • components/chat/{chat-thread.tsx, conversation-list.tsx, chat-parts.tsx, composer.tsx, emoji-picker.tsx, emoji.ts, format.ts, hooks.ts, icons.tsx, labels.ts, message-parts.tsx, message-row.tsx, toolbar-store.ts, types.ts}
  • components/alert-dialog/
  • components/avatar/
  • components/button/
  • components/chat/conversation-list/
  • components/chat/thread/
  • components/context-menu/
  • components/description-list/
  • components/dialog/
  • components/drawer/
  • components/empty-state/
  • components/file-upload/file-utils.ts
  • components/input/
  • components/kbd/
  • components/menu/
  • components/popover/
  • components/segmented/
  • components/side-drawer/{icons.tsx, side-drawer.tsx}
  • components/side-drawer/parts/{body.tsx, content.tsx, header.tsx, model.ts, resize.tsx}
  • components/skeleton/
  • components/spinner/
  • components/status-icons/
  • components/switch/
  • 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-control-shell.tsx, field-size.ts, form.ts, glide-highlight.tsx, heading.ts, ime.ts, initials.ts, math.ts, modal-flag.ts, modal-tab-trap.ts, motion-props.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-app.jsonRegistry item: chat-app. The styles need the Tailwind v4 glass UI setup.
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Props

PropTypeDefaultDescription
conversations (required)ChatConversation[]NoneLists the chats to show (ChatConversation[]).
participants (required)ChatParticipant[]NoneEveryone who appears in the chats, including the current user (ChatParticipant[]).
currentUserId (required)stringNoneThe id of the signed-in participant: their messages sit on the right.
messages (required)Record<string, ChatMessage[] | undefined>NoneMessages per chat id, oldest first (load a chat's messages when it is selected).
selectedIdstring | nullNoneThe open chat (controlled); null shows the list on phones and "Pick a chat" on wide screens.
defaultSelectedIdstring | nullnullThe chat open at first when selectedId is not controlled (string | null, default null).
onSelectedIdChange((conversationId: string | null) => void)NoneCalled when a chat is opened or closed: keep it in the URL to deep-link a chat.
loadingbooleanfalseShows skeleton rows in the conversation list while it loads.
hasOlder((conversationId: string) => boolean)NoneWhether a chat has earlier messages to load.
loadingOlderIdstring | nullnullThe chat whose earlier messages are loading.
onLoadOlder((conversationId: string) => void)NoneLoad a chat's earlier messages (the thread asks when its top is reached).
onSend((conversationId: string, draft: ChatDraft) => void)NoneA message (text, attachments, reply) was sent from the composer.
onEdit((conversationId: string, messageId: string, text: string) => void)NoneA sent message's text was edited.
onDelete((conversationId: string, message: ChatMessage) => void)NoneA message was deleted.
onReact((conversationId: string, message: ChatMessage, emoji: string, add: boolean) => void)NoneA reaction was added (add: true) or removed.
onRetry((conversationId: string, message: ChatMessage) => void)None"Retry" was pressed on a message that failed to send.
onRead((conversationId: string) => void)NoneThe newest message of a chat was seen: clear its unread count.
onTyping((conversationId: string, typing: boolean) => void)NoneThe current user started or stopped typing: send it on to the other side.
onDraftChange((conversationId: string, text: string) => void)NoneStore a chat's unsent text (shown as "Draft: …" in the list). Without it, drafts are kept in memory.
onConversationAction((conversation: ChatConversation, action: ChatConversationAction) => void)NonePin, mute, archive, mark read… (list and info panel).
onCall((conversation: ChatConversation) => void)NoneShows a call button in the chat header.
onVideoCall((conversation: ChatConversation) => void)NoneShows a video-call button in the chat header.
onBlock((participant: ChatParticipant) => void)NoneShows "Block" in a person's info panel.
onLeaveGroup((conversation: ChatConversation) => void)NoneShows "Leave group" in a group's info panel.
listPropsPartial<ConversationListProps>NoneExtra props for the list and the chat view.
threadPropsPartial<ChatThreadProps>NonePasses extra props to the chat view (Partial<ChatThreadProps>).
stackBelownumber640Container width (px) below which the panes stack (list, then chat).
nowDatethe real clock, refreshed every 30 secondsThe current time for "5m" and "last seen" labels. On a prerendered or server-rendered page pass a fixed date, so the HTML matches what the browser renders when it hydrates (and move it forward yourself after mounting).
localestringthe browser'sSets the BCP 47 locale for times and dates.
labelsPartial<ChatLabels>defaultChatLabelsEvery other string, for translation: labels={{ you: "…" }}; omitted keys keep the English of defaultChatLabels. All 140 keys of ChatLabels are listed in the key table under the props table.
classNamestringNoneClasses for the outer element (give it a height).
ChatLabels keys and English defaults (140)
Pass any key in labels; the rest keep the defaults of defaultChatLabels.
KeyEnglish default
youYou
youPrefixYou:
typing(names, group) => { if (!group || names.length === 0) return "typing…"; if (names.length === 1) return `${n...
draftPrefixDraft:
attachmentSummary(kind, count) => kind === "image" ? (count === 1 ? "Photo" : `${count} photos`) : count === 1 ? "File" : `$...
deletedMessageThis message was deleted
deletedOwnMessageYou deleted this message
status{ sending: "Sending", sent: "Sent", delivered: "Delivered", read: "Read", failed: "Not delivered" }
onlineOnline
awayAway
lastSeen(relative) => `Last seen ${relative}`
members(count, online) => online > 0 ? `${plural(count, "member", "members")}, ${online} online` : plural(count, "...
justNownow
chatsChats
searchSearch chats
searchPlaceholderSearch
clearSearchClear search
filtersLabelFilter chats
filters{ all: "All", unread: "Unread", groups: "Groups", archived: "Archived" }
pinnedSectionPinned
allSectionAll chats
unreadCount(count) => plural(count, "unread message", "unread messages")
unreadOverflow99+
pinnedPinned
mutedMuted
listHintArrow keys move between chats, Enter opens one, Shift+F10 shows its actions.
chatActions(name) => `Actions for ${name}`
pinPin
unpinUnpin
muteMute
unmuteUnmute
archiveArchive
unarchiveUnarchive
markReadMark as read
markUnreadMark as unread
loadingChatsLoading chats…
noChatsTitleNo chats yet
noChatsDescriptionWhen you start a conversation, it shows up here.
noResultsTitle(query) => `No chats match “${query}”`
noResultsDescriptionCheck the spelling, or search for a name or a word from a message.
emptyFilter{ unread: "You're all caught up", groups: "No group chats yet", archived: "No archived chats" }
resultsCount(count) => plural(count, "chat", "chats")
messagesWith(title) => `Messages with ${title}`
backBack to chats
callVoice call
videoCallVideo call
contactInfoContact info
groupInfoGroup info
messageRolemessage
newMessagesNew messages
editededited
messageFrom(name, time) => `${name}, ${time}`
replyReply
reactReact
copyCopy text
copiedCopied
copyFailedCouldn't copy. Select the text and copy it instead.
editEdit
deleteDelete
messageInfoMessage info
moreActionsMore actions
retryRetry
notDeliveredNot delivered
deleteTitleDelete this message?
deleteDescriptionIt will be removed for everyone in this chat. This can't be undone.
deleteConfirmDelete for everyone
cancelCancel
closeClose
sentAtSent
deliveredAtDelivered
readAtRead
notYetNot yet
replyingTo(name) => `Replying to ${name}`
cancelReplyCancel reply
editingMessageEditing message
cancelEditCancel editing
goToQuoted(name) => `Go to the message from ${name}`
originalNotLoadedThe original message isn't loaded yet.
jumpToLatestJump to latest message
newBelow(count) => plural(count, "new message", "new messages")
loadingOlderLoading earlier messages…
beginning(title) => `This is the beginning of your chat with ${title}.`
addReactionAdd reaction
moreEmojiMore emoji
reactionChip(emoji, count, mine) => `${emoji} ${count}${mine ? ", including you" : ""}`
reactionsReactions
openImage(name) => `Open ${name}`
imageViewerPhoto
previousImagePrevious photo
nextImageNext photo
imagePosition(index, count) => `${index} of ${count}`
download(name) => `Download ${name}`
morePhotos(count) => `+${count}`
logHintUp and Down arrows move between messages. Enter shows actions, R replies, E edits your own message.
messageMessage
placeholder(title) => (title ? `Message ${title}` : "Write a message…")
sendSend
saveEditSave changes
attachAttach files
emojiEmoji
attachmentsAttachments
removeAttachment(name) => `Remove ${name}`
keyHintEnter to send, Shift + Enter for a new line, Up arrow to edit your last message
keyHintTouchUse the send button to send
editHintEsc to cancel
searchEmojiSearch emoji
noEmojiNo emoji found
emojiCategories{ smileys: "Smileys", people: "People", hearts: "Hearts", nature: "Nature", food: "Food", activities: "Acti...
announceIncoming(name, text) => `${name}: ${text}`
announceFailedMessage not delivered
announceDeletedMessage deleted
announceReaction(emoji, added) => (added ? `Reacted ${emoji}` : `Removed ${emoji}`)
announceOlderLoaded(count) => `Loaded ${plural(count, "earlier message", "earlier messages")}`
announceReplying(name) => `Replying to ${name}. Type your reply.`
announceEditingEditing your message. Press Escape to cancel.
openChatOpen chat
closeChatClose chat
minimizeMinimise chat
widgetTitleSheenUI Support
widgetSubtitleWe typically reply in a few minutes
greetingHi there 👋
greetingDescriptionAsk us anything: we're real people and happy to help.
recentConversationsRecent conversations
sendUsMessageSend us a message
quickRepliesSuggested replies
backToHomeBack
helpHeadingFind an answer
widgetUnread(count) => plural(count, "unread message", "unread messages")
selectChatTitlePick a chat
selectChatDescriptionChoose a conversation from the list to read and reply.
aboutAbout
phonePhone
emailEmail
sharedMediaShared photos
noSharedMediaNo photos shared yet.
muteNotificationsMute notifications
unmuteNotificationsUnmute notifications
block(name) => `Block ${name}`
leaveGroupLeave group
membersHeading(count) => plural(count, "member", "members")

Keyboard

KeysAction
Tab/Shift + TabMoves between the chat list, the open chat and the composer. The list is one tab stop; the search field, filters and message actions are ordinary tab stops.
Arrow Up/Arrow Down, Home/EndIn the list: move between chats. Type a name to jump to that chat.
Enter/SpaceIn the list: open the focused chat. On a wide layout focus moves to the composer; on a narrow one it moves to the chat's name.
Shift + F10/Menu keyOpen a chat's actions (pin, mute, archive, mark read).
Arrow Up/Arrow Down, Enter, R, EIn the chat: move between messages, open a message's actions, reply, edit your own message.
Enter/Shift + EnterComposer: send / add a line (on touch keyboards Return adds a line). Arrow Up in an empty composer edits your last message.
EscapeCloses the contact or group info drawer and returns focus to the control that opened it.
Back buttonOn a narrow block, returns to the list and puts focus back on the chat's row.

Accessibility

  • The list and the chat are labeled regions. Focus is managed on every pane change: opening a chat on a phone moves it to the chat's name, going back returns it to the row, and a keyboard open on a wide layout lands in the composer.
  • New messages and typing are announced politely (aria-live); message status (sending, sent, delivered, read, failed) is written text, not color alone, and presence is written in words.
  • The info panel is a side drawer (a modal dialog with a focus trap); swipe and hover actions all have keyboard and menu equivalents, so nothing is gesture-only.
  • Reduced motion makes the pane slide a jump; reduced transparency makes the glass panes solid; the message area never uses blur, so scrolling stays fast.

When to use the chat app

  • Use ChatApp as a messenger UI for a messaging screen in a marketplace or support tool, where a conversation list sits beside the open chat on wide containers and stacks on narrow ones.
  • Use it for a team inbox with direct messages and groups, wiring onSend, onEdit, onDelete, onReact and onRetry to your backend while you hold the messages map in state.
  • Use it when contact info matters, since opening a chat's info drawer shows avatar, about, phone, email, members, shared photos, and mute and block or leave actions.
  • Skip it when you only need a floating help bubble on a marketing page; ChatWidget is lighter, and AiChat fits a person talking to a model rather than to other people.
  • Pair it with ConversationList and ChatThread when you want a custom layout from the same parts, and with EmptyState and SideDrawer for screens around the chat.

Frequently asked questions

20 blocks pages in all: browse them on All blocks.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .