---
title: "Customizing the support chat"
description: "Make the chat bubble look like your site, with a live preview, and the options for the element."
url: https://tufu.ai/docs/chat-widget/
---

# Customizing the support chat

Make the chat bubble look like your site, with a live preview, and the options for the element.

The support chat is the `<tufu-chat>` element. Installing it is covered in
[Installing on your website](https://tufu.ai/docs/install/); this page is about making it fit your site.

## The appearance studio

Open **Bots**, pick your bot and choose its **Look** tab. On one side are the settings; on the other, the real chat on
a stand-in page, updating as you go. Switch the preview between a desktop and a phone, a visitor in light or dark
mode, and a shop, a docs site, a blank page or your own site.

- **Match my website**: paste your address and tufu reads your colors and logo and suggests a look you can apply in
  one click.
- **Color**: pick one brand color. tufu builds the rest for light and dark pages and checks that every pair of text
  and background is readable (WCAG AA). If one isn't, it offers the nearest readable color. **Advanced colors** lets
  you set each one by hand. **Theme** keeps the chat light or dark, or follows each visitor.
- **Chat button**: a pill with a label, a round bubble, or a tab on the edge of the page; the icon (or your logo); the
  label; the side; how far from the corner. A **greeting bubble** adds a short message beside the button ("Hi! Ask me
  anything about shipping.") a couple of seconds after the page loads. It shows once per session, and not for a week after a visitor
  closes it. You can have it type itself out, appear when the visitor scrolls, or go away by itself. Leave it empty for none.
  **On some pages, say something else** gives a page its own message (up to five: `/pricing*` → "Questions about
  plans? Ask me."). The first that matches the page wins; everywhere else the bubble says its usual message, or nothing.
- **While the chat is open**: hide the button, so the chat window takes its space, or give it its own colors and corners.
  On phones the chat fills the screen, and the button is always hidden.
- **Chat window**: the name in the header, the avatar (Tuf, one of Tuf's flavors, your logo, or none), the corners
  and the font. Fonts are ones your visitors' devices already have, so nothing extra downloads on your site.
  - **Header color**: plain, a soft tint of your brand color, or the brand color itself. The header's text stays
    readable on it in light and dark mode: tufu adjusts the color if it has to.
  - **Header height**: standard, or compact to fit more of the conversation.
  - **Close button**: an X or a chevron (⌄). Either one hides the chat and keeps the conversation. For the most room,
    pair it with hiding the Chat button while the chat is open.
  - **Dock and size buttons**: shown, tucked into a ⋮ menu, or hidden. They never show on phones.
  - **Window size**: compact, standard or tall.
  - **Tabs** (support bots): **Chat only**, or **Chat and Docs** / **Docs and Chat** to put your bot's own
    [Ask console](https://tufu.ai/docs/ask-console/) in the same window, first or second. Rename either tab; if your knowledge isn't
    documentation, **Help** may suit better than Docs. **Pages to suggest in the Docs tab** (under Ask console) shows
    up to three of the pages your bot has read for the page the visitor is on, before they ask: `/pricing*` → your
    plans page and your FAQ.
  - **Start from**: Classic, Compact or Form first fill in these settings as a starting point. Form first also points you
    to **Leads**, where you turn on the form that comes before the conversation.
- **Welcome**: the top of a new chat. The message box's hint, a title ("How can we help?" unless you write your own), the greeting, and up to
  six suggested questions a visitor can tap to ask (tufu writes a few from your site when it first reads it).
  **Show who answers** adds the first names and photos of up to three people who get handoffs, and how fast your team
  usually replies ("Usually replies within an hour", once you've answered a few). Off by default. **Large photos**
  shows them big, on their own row, as a contact form does. Turn off **Show the title and team at the top** for a shorter start.
- **Messages**: what shows under each message, all off by default. The time it was sent, the bot's name on its answers,
  and who's in the conversation: a line at the top naming the bot as an AI assistant, and the time beside "Sam joined."
  when a person takes over.
- **AI notice**: the line at the top of the chat saying it's an AI, also shown on the Ask console and Telegram. It's always
  on. You can write your own wording, on any plan, as long as it still says it's an AI.
- **Branding**: on the Scale plan, or on Starter and Team with the brand
  removal add-on, you can hide "Powered by tufu" here. It also takes "via tufu" off the emails this bot sends.

Save, and visitors see the new look within about five minutes. There's nothing to change on your site.

## What visitors see

A "Chat with us" button in the corner of the page. It opens the chat in a panel above it, or a full-screen sheet on
phones, with your bot's name at the top. Visitors can dock the panel left, right or center and make it bigger.
**Esc** or the close button closes it, and the conversation stays put while they browse. The chat follows the
visitor's light or dark preference.

Inside, the bot answers with links to the pages it used (three, then "+2" for the rest), and **Talk to a human** hands
the conversation to your team. The 🙂 button beside the message box adds an emoji where the cursor is. The visitor always knows where things stand:

- **Sent to the team**, with how fast you usually reply, and "If you leave, we'll email the reply" once they've left
  their address. Outside your business hours: "We're away until Monday 9:00, and we'll reply by email", in their own
  time zone.
- **"Sam joined."** when someone picks it up, then **You're chatting with Sam**. People are only ever named by first
  name; without one, it's "the team".
- **"Sam marked this solved."** or **"Sam handed you back to Acme Help."** when you're done.
- If they closed the chat meanwhile, the button shows how many new replies are waiting.

With **Tabs** on, the top of the window has **Chat** and **Docs**. Docs searches your knowledge the way the
[Ask console](https://tufu.ai/docs/ask-console/) does, with short answers and links to the pages. When it doesn't help, "Still stuck?
Chat with us" (or "Want a person to help?" after a 👎) switches to Chat with the question already in the message box,
so the visitor doesn't type it twice. The tab they chose stays chosen while they browse your site. Each tab loads the
first time it's opened, and both keep their place after that.

Under each answer, 👍 and 👎 let the visitor say whether it helped. After a 👎 the chat asks what was wrong, with
three choices (**Wrong**, **Didn't answer my question**, **Out of date**; picking one is optional), and offers "Want a
person to help?". The 👎 shows up under [Knowledge gaps](https://tufu.ai/docs/knowledge-gaps/), and you see the vote and the reason
on the conversation in your inbox.

![The support chat open on a shop's page: the welcome title, two of the team's faces, the greeting and two suggested questions, with Talk to a human above the message box](https://tufu.ai/static/images/docs/chat-widget.png)

## Options

| Attribute | Default | What it does |
|---|---|---|
| `team` | (required) | Your team ID. |
| `bot` | (required) | The bot's handle. |
| `button-text` | the label set in tufu | The label next to the chat icon. `button-text=""` gives a round, icon-only button. |
| `position` | the side set in tufu | Where the chat opens on larger screens, and the side the button sits on: `right`, `left` or `center` (the button stays on the right). |
| `expanded` | not set | Add it to open the chat in its bigger size. |
| `visible` | not set | Add it to open the chat when the page loads. On a phone that's a full-screen sheet. |
| `hide-launcher` | not set | Hides the button, for a page that opens the chat from its own. `show()` still works. |

An attribute on the element wins over the same setting in the studio, except that `button-text` shows no label on a round bubble or with an animated avatar. Older snippets include
`button-text="Chat with us"`: remove it to use the label from the studio.

### JavaScript API

Everything is on the element: `const chat = document.querySelector('tufu-chat')`.

| Method | What it does |
|---|---|
| `chat.show()` | Opens the chat. |
| `chat.show({ question: 'Where is my order?' })` | Opens it with the question in the message box, for the visitor to send. |
| `chat.show({ tab: 'docs', question: 'How do refunds work?' })` | With [Tabs](https://tufu.ai/docs/chat-widget/#the-appearance-studio) on, opens the Docs tab and asks the question there. Without a Docs tab it opens the chat. |
| `chat.hide()` | Closes it. The conversation stays. |
| `await chat.ready()` | Resolves once the bot's settings have loaded: `false` when "Where it appears" rules the page out (send visitors to the chat page instead). Wait for it before offering your own "Chat with us" button. |
| `chat.pageViewed()` | For single-page apps: call it after your router changes the page, and "Where it appears" is checked for the new address. |

| Event | When |
|---|---|
| `tufuChatOpen` | The chat opens. |
| `tufuChatClose` | The chat closes. Call `preventDefault()` on it to put focus back on your own button rather than the chat's. |
| `tufuConversationStarted` | A visitor's first message starts a conversation. |
| `tufuHandoffRequested` | A conversation is sent to your team. |
| `tufuLeadCaptured` | A visitor left their details in your [lead form](https://tufu.ai/docs/leads/). |

The events bubble from the element, and `event.detail.bot` is the bot's handle; nothing about the visitor is in
them. None fire from tufu's own previews. With **Send to Google Tag Manager** on in the bot's settings, the page's
dataLayer also gets `tufu_started`, `tufu_handoff` and `tufu_lead` (and `tufu_booking` for a booked time).

```js
const chat = document.querySelector('tufu-chat');
chat.addEventListener('tufuHandoffRequested', () => analytics.track('Asked for a person'));
router.afterEach(() => chat.pageViewed()); // a single-page app
document.querySelector('#help').addEventListener('click', async () => {
  if (await chat.ready()) chat.show({ question: 'I need help with my order' });
});
```

```html
<tufu-chat team="your-team" bot="your-bot" button-text="Questions?" position="left"></tufu-chat>
```

## Styling it with CSS

The studio covers most needs. For more, the button lives in a shadow root, so you style it with CSS variables on the
`tufu-chat` element. Colors win over the studio's. The font, corners and distance are set on the element itself, so those
need `!important`. This example changes the colors:

```html
<style>
  tufu-chat {
    /* The button (defaults: tufu ink, flipped for dark mode) */
    --button-background-color: #1d4ed8;
    --button-background-color-hover: #1e3a8a;
    --button-text-color: #ffffff;
    --button-text-color-hover: #ffffff;
    --button-border-color: transparent;
    --button-border-color-hover: transparent;

    /* The open chat's header and footer */
    --tufu-panel-background: #ffffff;
    --tufu-panel-text-color: #0f1b2d;
    --tufu-panel-border-color: #e4e9f2;
  }
</style>
<tufu-chat team="your-team" bot="your-bot" button-text="Questions?"></tufu-chat>
```

## Clearing a bar on phones

The studio's distance applies at every size. To lift the button above a bar on phones only, set `bottom`:

```html
<style>
  @media (max-width: 640px) {
    tufu-chat { bottom: 80px; }
  }
</style>
```

To change the distance at every size from your own CSS, use `--tufu-offset-y: 80px !important`; without `!important` the
studio's value wins. That also moves the chat window on larger screens. A plain `bottom` moves only the button.

## Showing above other elements

If the chat appears below something else on your page, raise its `z-index` with `--tufu-z-index` (the default is
`50`):

```html
<style>
  tufu-chat {
    --tufu-z-index: 1000;
  }
</style>
```
