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.jsonSupport 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.
import { ChatWidget } from "@/components/sheenui/chat/chat-widget";
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 { ChatWidget, type ChatConversation, type ChatDraft, type ChatMessage, type ChatParticipant } from "@sheenui/theme";
// Your data layer: replace these with real data and handlers.
declare const supportChats: ChatConversation[];
declare const messagesById: Record<string, ChatMessage[]>;
declare const people: ChatParticipant[];
declare const api: {
startConversation(): string;
send(chatId: string, draft: ChatDraft): void;
markRead(chatId: string): void;
};
export function Example() {
return (
<ChatWidget
conversations={supportChats}
messages={messagesById}
participants={people}
currentUserId="me"
teamIds={["sana", "leo", "maya"]}
onNewConversation={() => api.startConversation()} // return the new chat's id
onSend={(chatId, draft) => api.send(chatId, draft)}
onRead={(chatId) => api.markRead(chatId)}
quickReplies={["I have a billing question 💳", "Report a bug 🐞", "Talk to sales"]}
helpLinks={[
{ label: "Install SheenUI in a Vite app", description: "Getting started", href: "#install" },
{ label: "Theming, tokens and dark mode", description: "Guides", href: "#theming" },
{ label: "Billing and invoices", description: "Account", href: "#billing" },
]}
/>
);
}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.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
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.
import { ChatWidget } from "@/components/sheenui/chat/chat-widget";
import { type ChatConversation, type ChatMessage, type ChatParticipant } from "@/components/sheenui/chat/types";
// Package build (after the first npm release, or a packed tarball): import { ChatWidget, type ChatConversation, type ChatMessage, type ChatParticipant } from "@sheenui/theme";
// Your data layer: replace these with real data.
declare const conversations: ChatConversation[];
declare const messagesById: Record<string, ChatMessage[]>;
declare const people: ChatParticipant[];
export function Example() {
return (
<ChatWidget
conversations={conversations}
messages={messagesById}
participants={people}
currentUserId="me"
position="left"
labels={{
greeting: "नमस्ते 🙏",
greetingDescription: "कुछ भी पूछिए, हम मदद के लिए यहाँ हैं।",
widgetTitle: "SheenUI सहायता",
widgetSubtitle: "हम आमतौर पर कुछ ही मिनटों में जवाब देते हैं",
sendUsMessage: "हमें संदेश भेजें",
recentConversations: "हाल की बातचीत",
openChat: "चैट खोलें",
closeChat: "चैट बंद करें",
minimize: "चैट छोटा करें",
backToHome: "वापस",
placeholder: () => "संदेश लिखें…",
helpHeading: "जवाब खोजें",
}}
helpLinks={[{ label: "शुरू कैसे करें", href: "#install" }]}
/>
);
}Props
ChatLabels keys and English defaults (140)
Keyboard
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
Related pages
67 components pages in all: browse them on All components.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .