# Support chat — Detent

> The help bubble in the corner, done properly. It answers from your help center with the sources it read, does the task when it can, takes a screenshot, and when it cannot help, a teammate joins the same chat already knowing everything.

Canonical: https://detentui.com/components/support-chat
Last updated: 2026-11-19

## About

The help bubble in the corner, done properly. It answers from your help center with the sources it read, does the task when it can, takes a screenshot, and when it cannot help, a teammate joins the same chat already knowing everything.

## When to use

- Use it for: The help widget in the corner of a product, answered by AI with a person behind it.
- Don't use it for: A full chat app or an internal team inbox.

## Placement

Mounted once at the root of your app, inside a positioned container; it pins itself to the bottom corner set by `side`.

## For agents

Prompt to give a coding agent: "Add Detent's Support chat to this project. Fetch https://detentui.com/components/support-chat.md and follow its "For agents" steps. It's a Detent Pro piece: if the @detent-pro registry isn't set up here yet, do https://detentui.com/pro-setup.md first."

1. Check package.json: Detent needs React 19 and Tailwind CSS v4. If either is missing or older, stop and tell the user.
2. If the project root has no components.json, run `npx shadcn@latest init --defaults --yes` there.
3. This is a Pro piece. If components.json has no "@detent-pro" registry, or .env.local has no DETENT_PRO_KEY, follow https://detentui.com/pro-setup.md first. If the user has no Pro key, don't install it: tell them it needs Detent Pro and what it would add (this page's About), and only offer a free piece from https://detentui.com/agents.md if one genuinely does the same job.
4. Install it from the project root: `npx shadcn@latest add @detent-pro/support-chat`
5. Make sure the root layout (in Next.js, app/layout.tsx) wraps its children once in `<MotionConfig reducedMotion="user">` from motion/react. Add it only if it is not there.
6. Import `SupportChat` from `@/components/detent/components/support-chat/SupportChat` and render it where the user asked, sized and placed as the Placement section says. Start from the Example below (required props: `brand`, `team`, `examples`, `ask`), keep its layout, and swap in the project's real data.
7. If the project has no real data for it yet, put clearly marked placeholders in one content file. Never invent customer quotes, names or numbers and present them as real.
8. Detent pieces are client components. If you pass them functions (format, onChange, render props), do it from a client component; a server page can only pass plain data, so load the data on the server and hand it to a small client wrapper.
9. Use the Detent theme tokens (like bg-surface, text-ink, text-ink-3) for anything you draw around it, and className where the piece takes one. Don't rewrite its motion or internals.
10. Run the project's typecheck (for example `npx tsc --noEmit`; on a fresh Next.js project run `npx next typegen` first, or it can't find types like LayoutProps). If you can run the app, open the page at a desktop and a phone width and check it renders with no console errors.
11. If AGENTS.md or CLAUDE.md has no Detent section yet, add the block from https://detentui.com/agents.md so later tasks pick the right pieces.
12. Tell the user what you added, where, and anything they still need to fill in.

## Details

- Answers stream in with the articles they came from, plus copy, thumbs and suggested follow-ups.
- Replies can carry an action card, like switching plan, that runs right in the thread.
- Attach a screenshot by button, paste or drop. After a handoff, messages go to the person, with Seen and a one-time rating.
- Close it mid-reply and the answer arrives as a peek above the launcher with an unread count.

## Install

Part of Detent Pro. The `@detent-pro` registry must be in components.json and `DETENT_PRO_KEY` set in .env.local first: https://detentui.com/pro-setup.md

```bash
npx shadcn add @detent-pro/support-chat
```

Needs React 19 and Tailwind CSS v4. The source lands in components/detent; import it from `@/components/detent/components/support-chat/SupportChat`.

## Looks like

![Support chat](https://detentui.com/components/support-chat/opengraph-image)

This is the example below, rendered. The live, interactive version is at https://detentui.com/components/support-chat.

## Example

A working example that typechecks against the installed piece. Keep its layout as a starting point and swap the sample data for the project's real data. Outer wrappers like `size-full` or a dark background come from the demo stage: give the parent a real size, or drop them.

```tsx
'use client'

import { AnimatePresence, motion } from 'motion/react'
import { useState } from 'react'
import type { CSSProperties, ReactNode } from 'react'
import { SupportChat, VARS } from '@/components/detent/components/support-chat/SupportChat'
import type { Person, Reply } from '@/components/detent/components/support-chat/SupportChat'

const MOCK = {
  '--edge': 'light-dark(rgb(0 0 0 / .08), rgb(255 255 255 / .09))',
  '--soft': 'light-dark(#f3f3f2, #232326)',
  '--field': 'light-dark(#f6f6f5, #1c1c1f)',
  '--btn': 'light-dark(#18181b, #f2f2f4)',
  '--btn-ink': 'light-dark(#ffffff, #18181b)',
} as CSSProperties
type Page = 'General' | 'Members' | 'Billing' | 'API keys'
const PAGES: Page[] = ['General', 'Members', 'Billing', 'API keys']
const TEAM: Person[] = [
  { name: 'Ana', role: 'Support', tint: '#e0703c', photo: 'https://images.unsplash.com/photo-1736962260221-66372772e63d?w=160&h=160&fit=crop&crop=faces&q=80' },
  { name: 'Theo', role: 'Support', tint: '#4b7bec', photo: 'https://images.unsplash.com/photo-1480455624313-e29b44bbfde1?w=160&h=160&fit=crop&crop=faces&q=80' },
  { name: 'Priya', role: 'Support', tint: '#2fa57a', photo: 'https://images.unsplash.com/photo-1637325262485-5cf1abb98c05?w=160&h=160&fit=crop&crop=faces&q=80' },
]
const EXAMPLES = ['How do I change my plan?', 'How do I invite a teammate?', 'Where do I create an API key?', 'Can I turn on SSO?']
const ask = (q: string): Reply => {
  const s = q.toLowerCase()
  if (/person|human|agent|someone/.test(s)) return { text: 'Sure. Ana from the support team can pick this up. She’ll see this whole chat, so you won’t have to explain again.', handoff: true }
  if (/downgrade/.test(s)) return { text: 'Nothing is deleted. On Starter you keep all your projects, but only 3 people can edit. Everyone else becomes a viewer until you upgrade again.', sources: [{ title: 'What changes when you downgrade', read: '2 min' }], followups: ['Who becomes a viewer first?'] }
  if (/viewer/.test(s)) return { text: 'You choose. When the downgrade starts, Tandem asks which 3 people stay editors. If you skip it, the 3 most active people stay.', sources: [{ title: 'Roles and seats', read: '3 min' }] }
  if (/seat/.test(s)) return { text: 'Only once they accept. Pending invites are free.', sources: [{ title: 'Roles and seats', read: '3 min' }] }
  if (/plan|upgrade|price/.test(s)) return { text: 'I can switch it for you here. Upgrades start right away and are prorated for the rest of the month. Downgrades start at your next renewal on Dec 1.', action: { title: 'Change plan', from: 'Team · $48/mo', to: 'Business · $120/mo', note: 'Prorated today: $43.20 on Visa •• 4242', cta: 'Switch to Business', done: 'You’re on Business. Receipt sent to maya@tandem.so' }, sources: [{ title: 'Changing your plan', read: '2 min' }, { title: 'How proration works', read: '3 min' }, { title: 'Billing FAQ', read: '5 min' }], followups: ['What happens to my data if I downgrade?', 'Can I pay yearly instead?'] }
  if (/yearly|annual/.test(s)) return { text: 'Yes. Yearly billing is 2 months free. Switch in Settings → Billing → Billing period. The change starts on your next renewal.', sources: [{ title: 'Yearly billing', read: '1 min' }] }
  if (/invite|teammate|member/.test(s)) return { text: 'Go to Settings → Members and press Invite. They get an email and join as a Member. Admins can change anyone’s role after they join.', sources: [{ title: 'Inviting teammates', read: '1 min' }, { title: 'Roles and seats', read: '3 min' }], followups: ['Do invites use a paid seat?'] }
  if (/key|api|token/.test(s)) return { text: 'Keys live in Settings → API keys. A new key is shown once, so copy it before you leave the page. To rotate, create a new key, update your apps, then revoke the old one.', sources: [{ title: 'Creating and rotating API keys', read: '3 min' }], followups: ['How do I revoke a leaked key?'] }
  if (/revoke|leak/.test(s)) return { text: 'Open Settings → API keys, find the key and choose Revoke. It stops working within a minute. Then create a new one for your apps.', sources: [{ title: 'Creating and rotating API keys', read: '3 min' }] }
  if (/sso|saml|2fa|security/.test(s)) return { text: 'SSO with SAML is on the Business plan. Your workspace is on Team, so it isn’t available yet. Two-step sign-in works on every plan, under your profile → Security.', sources: [{ title: 'Single sign-on', read: '4 min' }], handoff: true }
  return { text: 'I couldn’t find that in the help center. Someone from the team can take a look.', handoff: true }
}
const BTN = 'h-8 rounded-[9px] px-3 text-[12.5px] font-medium transition-[transform,background-color] duration-150 active:scale-[.97] outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--focus)] pointer-coarse:h-10'
const PRIMARY = `${BTN} bg-[var(--btn)] text-[var(--btn-ink)]`
const QUIET = `${BTN} text-ink shadow-[inset_0_0_0_0.5px_var(--edge)] hover:bg-[var(--soft)]`
const MEMBERS = [
  { name: 'Maya Lin', mail: 'maya@tandem.so', role: 'Owner' },
  { name: 'Theo Park', mail: 'theo@tandem.so', role: 'Admin' },
  { name: 'Ana Ruiz', mail: 'ana@tandem.so', role: 'Member' },
  { name: 'Sam Okafor', mail: 'sam@tandem.so', role: 'Member' },
]
function Row({ label, children }: { label: string; children: ReactNode }) {
  return (
    <div className="flex flex-col gap-2 border-t border-[var(--edge)] py-4 first:border-t-0 @lg:flex-row @lg:items-center @lg:justify-between">
      <span className="text-[13px] text-ink-2">{label}</span>
      {children}
    </div>
  )
}
function Content({ page }: { page: Page }) {
  const [plans, setPlans] = useState(false)
  const [plan, setPlan] = useState('Team')
  const [inviting, setInviting] = useState(false)
  const [keys, setKeys] = useState(2)

  if (page === 'General')
    return (
      <>
        <Row label="Workspace name">
          <input defaultValue="Tandem Labs" className="h-8 w-full rounded-[9px] bg-[var(--field)] px-3 text-[13px] text-ink outline-none shadow-[inset_0_0_0_0.5px_var(--edge)] focus:shadow-[inset_0_0_0_1px_var(--focus)] @lg:w-60 pointer-coarse:h-10 pointer-coarse:text-[16px]" />
        </Row>
        <Row label="URL">
          <span className="text-[13px] text-ink">tandem.so/labs</span>
        </Row>
        <Row label="Time zone">
          <span className="text-[13px] text-ink">Asia/Kolkata · GMT+5:30</span>
        </Row>
      </>
    )

  if (page === 'Members')
    return (
      <>
        <div className="flex items-center justify-between pb-3">
          <span className="text-[13px] text-ink-3">{MEMBERS.length} people</span>
          <button type="button" onClick={() => setInviting(true)} className={PRIMARY}>
            Invite
          </button>
        </div>
        <AnimatePresence initial={false}>
          {inviting && (
            <motion.div initial={{ opacity: 0, height: 0 }} animate={{ opacity: 1, height: 'auto' }} className="overflow-hidden">
              <div className="mb-3 flex gap-2">
                <input autoFocus placeholder="name@company.com" className="h-8 min-w-0 flex-1 rounded-[9px] bg-[var(--field)] px-3 text-[13px] text-ink outline-none shadow-[inset_0_0_0_0.5px_var(--edge)] placeholder:text-ink-3 focus:shadow-[inset_0_0_0_1px_var(--focus)] pointer-coarse:h-10 pointer-coarse:text-[16px]" />
                <button type="button" onClick={() => setInviting(false)} className={QUIET}>
                  Send invite
                </button>
              </div>
            </motion.div>
          )}
        </AnimatePresence>
        {MEMBERS.map((m) => (
          <div key={m.mail} className="flex items-center gap-3 border-t border-[var(--edge)] py-3">
            <span className="grid size-7 shrink-0 place-items-center rounded-full bg-[var(--soft)] text-[11px] font-medium text-ink-2">{m.name[0]}</span>
            <span className="min-w-0 flex-1">
              <span className="block truncate text-[13px] text-ink">{m.name}</span>
              <span className="block truncate text-[12px] text-ink-3">{m.mail}</span>
            </span>
            <span className="text-[12.5px] text-ink-3">{m.role}</span>
          </div>
        ))}
      </>
    )

  if (page === 'Billing')
    return (
      <>
        <div className="rounded-[14px] p-4 shadow-[inset_0_0_0_0.5px_var(--edge)]">
          <div className="flex items-start justify-between gap-3">
            <div>
              <p className="text-[14px] font-semibold text-ink">{plan}</p>
              <p className="mt-1 text-[12.5px] text-ink-3">{plan === 'Starter' ? 'Free · up to 3 people' : plan === 'Team' ? '$48 a month · 6 seats · renews Dec 1' : '$120 a month · unlimited seats · renews Dec 1'}</p>
            </div>
            <button type="button" onClick={() => setPlans((v) => !v)} aria-expanded={plans} className={QUIET}>
              Change plan
            </button>
          </div>
          <AnimatePresence initial={false}>
            {plans && (
              <motion.div initial={{ opacity: 0, height: 0 }} animate={{ opacity: 1, height: 'auto' }} exit={{ opacity: 0, height: 0 }} className="overflow-hidden">
                <div role="radiogroup" aria-label="Plans" className="mt-4 grid gap-2 @lg:grid-cols-3">
                  {[
                    ['Starter', 'Free'],
                    ['Team', '$48/mo'],
                    ['Business', '$120/mo'],
                  ].map(([n, p]) => (
                    <button
                      key={n}
                      type="button"
                      role="radio"
                      aria-checked={plan === n}
                      onClick={() => {
                        setPlan(n)
                        setPlans(false)
                      }}
                      className={`flex items-center justify-between rounded-[10px] px-3 py-2.5 text-left text-[13px] transition-[transform,box-shadow] duration-150 active:scale-[.97] outline-none focus-visible:outline-2 focus-visible:outline-[var(--focus)] ${plan === n ? 'text-ink shadow-[inset_0_0_0_1.5px_var(--btn)]' : 'text-ink-2 shadow-[inset_0_0_0_0.5px_var(--edge)] hover:bg-[var(--soft)]'}`}
                    >
                      {n}
                      <span className="text-[12px] text-ink-3">{p}</span>
                    </button>
                  ))}
                </div>
              </motion.div>
            )}
          </AnimatePresence>
        </div>
        <p className="mb-1 mt-6 text-[12.5px] text-ink-3">Invoices</p>
        {[
          ['Nov 1, 2026', '$48.00'],
          ['Oct 1, 2026', '$48.00'],
          ['Sep 1, 2026', '$40.00'],
        ].map(([d, a]) => (
          <div key={d} className="flex items-center justify-between border-t border-[var(--edge)] py-3 text-[13px]">
            <span className="text-ink">{d}</span>
            <span className="tabular-nums text-ink-2">{a}</span>
          </div>
        ))}
      </>
    )

  return (
    <>
      <div className="flex items-center justify-between pb-3">
        <span className="text-[13px] text-ink-3">Keys give full access to this workspace.</span>
        <button type="button" onClick={() => setKeys((k) => k + 1)} className={PRIMARY}>
          Create key
        </button>
      </div>
      {Array.from({ length: keys }, (_, i) => keys - 1 - i).map((i) => (
        <motion.div key={i} initial={i >= 2 ? { opacity: 0, y: -4 } : false} animate={{ opacity: 1, y: 0 }} className="flex items-center justify-between gap-3 border-t border-[var(--edge)] py-3">
          <span className="min-w-0">
            <span className="block text-[13px] text-ink">{i === 0 ? 'Production' : i === 1 ? 'Staging' : `Key ${i + 1}`}</span>
            <span className="block font-mono text-[12px] text-ink-3">tdm_live_••••{['8f2a', '41c9', '07de', 'b3e1', '9a6c'][i % 5]}</span>
          </span>
          <span className="shrink-0 text-[12px] text-ink-3">{i >= 2 ? 'Created just now' : i === 0 ? 'Used 2m ago' : 'Used yesterday'}</span>
        </motion.div>
      ))}
    </>
  )
}
export function SupportChatExample() {
  const [page, setPage] = useState<Page>('General')
  return (
    <div style={{ ...VARS, ...MOCK }} className="relative size-full overflow-hidden bg-[var(--bg)] @container">
      <div className="flex h-full">
        <nav aria-label="Settings" className="flex w-[200px] shrink-0 flex-col gap-0.5 border-r border-[var(--edge)] p-3 @max-2xl:w-auto @max-2xl:border-r-0 @max-2xl:p-2">
          <p className="mb-3 flex items-center gap-2 px-2 pt-1 text-[13px] font-semibold text-ink @max-2xl:hidden">
            <span className="grid size-5 place-items-center rounded-[6px] bg-[var(--btn)] text-[10px] text-[var(--btn-ink)]">T</span>
            Tandem
          </p>
          {PAGES.map((p) => (
            <button
              key={p}
              type="button"
              aria-current={page === p ? 'page' : undefined}
              onClick={() => setPage(p)}
              className={`h-8 rounded-[8px] px-2 text-left text-[13px] transition-[transform,background-color,color] duration-150 active:scale-[.97] outline-none focus-visible:outline-2 focus-visible:outline-[var(--focus)] pointer-coarse:h-10 ${page === p ? 'bg-[var(--soft)] text-ink' : 'text-ink-2 hover:text-ink'}`}
            >
              {p}
            </button>
          ))}
        </nav>
        <div className="min-w-0 flex-1 overflow-y-auto overscroll-contain px-6 py-7 @max-2xl:px-4">
          <h2 className="text-[20px] font-semibold tracking-[-0.02em] text-ink">{page}</h2>
          <div className="mt-5 max-w-[560px]">
            <Content key={page} page={page} />
          </div>
        </div>
      </div>
      <SupportChat brand="Tandem" name="Maya" team={TEAM} examples={EXAMPLES} ask={ask} />
    </div>
  )
}
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `brand` (required) | `string` |  | Your product's name, used in the greeting and placeholder. |
| `name` | `string` |  | The signed-in person's first name for the greeting. |
| `team` (required) | `Person[]` |  | The people a chat can be handed to: name, role, tint and photo. |
| `examples` (required) | `string[]` |  | Example questions that rotate on the welcome screen. |
| `ask` (required) | `(question: string) => Promise<Reply> \| Reply` |  | Answers a question with text, sources, follow-ups, an action or a handoff. |
| `side` | `'right' \| 'left'` | `'right'` | Which bottom corner the launcher sits in. |

## Keyboard shortcuts

| Keys | Action |
| --- | --- |
| Enter | Send |
| Esc | Close |

## Motion and accessibility

- Wrap your root layout once in `<MotionConfig reducedMotion="user">` from motion/react; every Detent piece then respects reduced motion.
- Style it through the Detent theme tokens and `className`, not by editing internals first.

Every Detent piece, with when to use each: https://detentui.com/llms.txt · Agent rules to paste into AGENTS.md: https://detentui.com/agents.md

## Related
- [All components](https://detentui.com/components)
- [Pro](https://detentui.com/pro)
