Skip to content

Support Chat Widget for React

A React chat widget for support: a launcher in the corner of the page springs open a glass panel with a greeting and recent conversations.

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

Support widget

Press the launcher in the bottom-right corner. Start a new conversation, tap a quick reply, and the team answers. In your app use the default strategy="fixed"; this preview keeps it inside the frame.

Files to copy

22 folders · 38 files · 4 packages
From theme/src/
  • components/chat/{chat-thread.tsx, chat-widget.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/thread/
  • components/context-menu/
  • components/description-list/
  • components/dialog/
  • components/drawer/
  • components/file-upload/file-utils.ts
  • components/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

On the left, in Hindi

position="left" for right-to-left layouts or when something else lives in the right corner. Every string is a label.

Props

PropTypeDefaultDescription
conversations (required)ChatConversation[]NoneThe support chats this visitor has had, newest activity first.
messages (required)Record<string, ChatMessage[] | undefined>NoneTakes messages per chat id (oldest first).
participants (required)ChatParticipant[]NoneEveryone who can appear: the visitor and the team.
currentUserId (required)stringNoneId of the visitor, used to tell which messages are theirs.
teamIdsstring[]everyone except youThe team shown in the header (participant ids); defaults to everyone except you.
openbooleanNoneWhether the panel is open (controlled).
defaultOpenbooleanfalseWhether the panel starts open (uncontrolled).
onOpenChange((open: boolean) => void)NoneCalled with the new state when the panel opens or closes.
conversationIdstring | nullNoneThe chat shown in the panel; null shows the home view.
defaultConversationIdstring | nullnullThe chat shown on mount (uncontrolled); null is the home view.
onConversationChange((conversationId: string | null) => void)NoneCalled with the chat id when the visitor opens a chat, or null when they go back home.
onNewConversation(() => string) | (() => void)None"Send us a message": create a chat and return its id (it opens once it is in conversations).
onSend((conversationId: string, draft: ChatDraft) => void)NoneThe visitor sent a message in the chat with this id.
onReact((conversationId: string, message: ChatMessage, emoji: string, add: boolean) => void)NoneCalled when the visitor adds or removes a reaction.
onRetry((conversationId: string, message: ChatMessage) => void)NoneThe visitor pressed Retry on a failed message.
onRead((conversationId: string) => void)NoneThe visitor saw the newest message of this chat: mark it read.
quickRepliesstring[]NoneChips that send a ready-made message (shown in a chat until you write something).
threadPropsPartial<ChatThreadProps>NoneExtra props for the chat view inside the panel.
homeContentReactNodeNoneContent above "Send us a message" on the home view (a status line…).
helpLinksChatWidgetLink[]NoneHelp articles under the recent conversations on the home view ("Find an answer").
position"left" | "right""right"Sets the physical corner of the launcher.
strategy"absolute" | "fixed""fixed""fixed" to the window, or "absolute" inside a positioned box (previews, docs).
unreadCountnumberthe unread count of every chatThe launcher's badge; defaults to the unread count of every chat.
nowDatethe real clock, refreshed every 30 secondsThe current time for "5m" labels. On a prerendered or server-rendered page pass a fixed date, so the HTML matches what the browser renders when it hydrates.
localestringthe browser'sSets the BCP 47 locale for times and dates.
labelsPartial<ChatLabels>defaultChatLabelsAny UI string (i18n); see ChatLabels (every key is listed below the table). Every 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.
headingLevelHeadingLevelOption3Heading level (2 or 3) of the panel's headings ("Recent conversations", help articles) and of the open conversation's title, to fit the page outline. "none" renders them as paragraphs, for a widget shown as an example.
classNamestringNoneClasses for the outer element (the launcher's corner).
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
Enter/SpaceOpen the panel from the launcher.
EscapeClose the panel and return focus to the launcher (inside a menu or the emoji picker it closes only that).
Tab/Shift + TabOn phones the full-screen sheet is modal: focus stays inside.
Chat keysInside a chat the ChatThread keys apply.

Accessibility

  • A dialog named by the team header (aria-modal only on phones, where the sheet covers the page); the launcher has aria-expanded and the unread count in its name.
  • The sheet makes the page behind inert and keeps the composer above the on-screen keyboard.
  • Every string is translatable through labels, including right-to-left layouts.

When to use the popover chat widget

  • Use it as an Intercom-style live chat widget in the bottom corner of a marketing site or web app, with a launcher, an unread badge and a panel that springs out of the launcher.
  • Use homeContent and helpLinks to add a status line and a Find an answer card with help articles, so visitors can self-serve before starting a conversation.
  • Use position="left" when another element already lives in the right corner, strategy="absolute" to keep it inside a positioned box, and translate every string through labels.
  • Skip it when chat is the main screen of your product; Chat list with Chat view gives a full-page messaging layout, and a Dialog is better for a one-off message form.
  • Pair it with the Chat view through threadProps, quickReplies for chips that send a ready-made message, and Toast for your own notification when the team replies.

Frequently asked questions

67 components pages in all: browse them on All components.

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