Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Chat Widget

ProNew

One launcher for WhatsApp, Messenger, Telegram, Viber, LINE and more: branded chat, typed greeting and a button or multi-channel row that continues in the selected app.

Installation

pnpm dlx shadcn@latest add @viewport/chat-widget

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
channelChatChannel

The messenger this widget opens. It sets the brand color, icon and button text.

"whatsapp"
contactstring

Phone number, username or page id on that channel, or a full URL.

""
channelsChatChannelLink[]

Offer several messengers instead of one: the window ends in a row of brand buttons.

—
agentChatAgent

Who the visitor is talking to, shown in the header.

{ name: "Support", caption: "Typically replies within minutes" }
onlineboolean

Shows the green dot on the avatar.

true
greetingstring | string[]

Greeting, typed out one bubble at a time after the window opens.

"Hi there 👋\nHow can I help you?"
replyFieldboolean

Let visitors write their first message here; sending opens the channel with the text filled in where the channel supports it. Single channel only.

false
onSend(text: string, channel: ChatChannel) => void

Called with the text when the visitor sends from the reply field.

—
buttonLabelstring

Text of the start-chat button.

—
layout"floating" | "inline"

`floating` pins a launcher to a corner of the viewport, `inline` renders the open window in the page.

"floating"
skin"brand" | "plain"

`brand` colors the header and wallpaper like the messenger, `plain` uses your theme's own surface and text colors.

"brand"
accentstring

Any CSS color, replacing the channel's own for the header, button and launcher.

—
launcher"bubble" | "pill"

Round icon button, or a pill with the label next to the icon.

"bubble"
launcherLabelstring

Accessible name of the launcher, and the visible text of the pill.

"Chat with us"
badgenumber

Unread count on the launcher until the window is first opened. 0 hides it.

1
teaserstring

A short line that pops up beside the closed launcher to invite a click.

—
position"bottom-right" | "bottom-left""bottom-right"
openboolean

Controlled open state for the floating layout.

—
defaultOpenbooleanfalse
onOpenChange(open: boolean) => void—
classNamestring—

Accessibility

  • The launcher is a button that reports expanded state and its unread count; the window is a named, non-modal dialog so the page stays usable.
  • Opening moves focus into the window; Escape or Close returns it to the launcher.
  • Greetings arrive in a polite live log, and the typing dots read as “Maya is typing”.
  • Configured channel links are named and restricted to web or matching app schemes; an unsafe contact has no interactive link.
  • White text sits on a deepened shade of each brand color to keep its contrast; the typing dots and pop-in stop under reduced motion.