# Launcher widget

The chat bubble for a website, done properly: unread count, a greeting that steps aside, and a panel that grows out of the launcher.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: Launcher widget. A bookkeeping site's pricing page: a greeting appears, the panel grows out of the launcher, and a plan question gets answered. Preview: https://chatcn.dev/preview/launcher-widget-demo

## Installation

```bash
npx shadcn@latest add @chatcn-pro/launcher-widget
```

## Usage

```tsx
import { LauncherWidget } from "@/components/ui/chatcn/pro/launcher-widget"

<LauncherWidget
  title="Saltmarsh"
  subtitle="Answers right away, a person within a working day"
  greeting="Choosing a plan? Ask me anything about them."
  unread={unread}
  messages={messages}
  status={status}
  onSend={send}
/>
```

Closed, it is a launcher in the bottom corner with an unread count, and an optional greeting beside it that the reader can open or dismiss. Open, the panel grows out of the launcher's corner on the kit's spring, and the launcher's glyph turns into a chevron that closes it from the same spot, so opening and closing happen in one place. On a host narrower than 520 px the panel becomes a full height sheet. The subtitle is the place to be honest about who answers and how fast. `placement="contained"` keeps it inside its parent for dashboards and previews; the default floats over the viewport like a site widget.

## Examples

### States

Example: States. Closed with a greeting and unread, open with common questions, answered, a failed answer, and the start side. Preview: https://chatcn.dev/preview/launcher-widget-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `messages` | `ChatcnMessage[]` | The thread, in the kit's message contract |
| `status`, `error`, `onStop`, `onRetry` | `"ready" | "submitted" | "streaming" | "error"` | Send becomes Stop while it streams; an error offers Try again |
| `value`, `defaultValue`, `onValueChange` | `string` | The draft, controlled or not |
| `onSend` | `(text) => void` |  |
| `open`, `defaultOpen`, `onOpenChange` | `boolean` |  |
| `title`, `subtitle`, `avatar` | `ReactNode` | Who answers, and how fast |
| `greeting`, `onGreetingDismiss` | `ReactNode`, `() => void` | A note beside the closed launcher |
| `unread` | `number` | Shown on the closed launcher and in its name |
| `suggestions` | `string[]` | Common questions in the empty state |
| `side` | `"start" | "end"` | Which bottom corner. Default the inline end |
| `placement` | `"fixed" | "contained"` | Over the viewport, or inside the parent |
| `disabled` | `boolean` |  |
| `labels` | `Partial<LauncherWidgetLabels>` | Every string, for translation |

## Keyboard

| Key | Action |
| --- | --- |
| Enter or Space on the launcher | Open or close the panel |
| Escape | Close the panel, focus back on the launcher |
| Enter, Shift Enter | Send, new line |

## Accessibility

- The launcher says whether it opens or closes and how many replies are unread, and reports its expanded state.
- Closed, the panel is inert, so focus and screen readers never land in it.
- Opening moves focus to the input; closing returns it to the launcher.
- The unread count is a blue info mark with the number in text, never color alone.

## Motion

The panel scales up from the launcher's corner on the kit's spring and fades; closing plays it back faster. The launcher's glyph crossfades with a small turn. On phones the sheet rises 24 px instead. Under reduced motion everything fades in place.

Source: https://chatcn.dev/docs/components/launcher-widget