# ConnectWhatsAppButton

> Props, styling and a live ConnectWhatsAppButton example.

`ConnectWhatsAppButton` from `@polymorfa/react`. Choose props and styles above; the preview stays visible in every code view.

## Props

| Prop | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `children` | `ReactNode` | Optional | "Connect WhatsApp" | Button label. |
| `onConnect` | `(result: ConnectWhatsAppResult) => void` | Optional |  | Called after the QuickLink is created and opened. |
| `onError` | `(error: unknown) => void` | Optional |  | Called when the QuickLink cannot be created. |
| `className` | `string` | Optional |  | Root class and slot classes. |
| `classNames` | `SlotClassNames` | Optional |  | Root class and slot classes. |
| `target` | `"redirect" \| "popup"` | Optional | `"redirect"` | `redirect` (default) navigates this tab, `popup` opens a new tab. Open the popup in the click handler so browsers do not block it. |
| `open` | `(url: string) => void` | Optional |  | Replaces navigation, for tests and custom flows. |

## Styling

Use `className`, `classNames` (a class for any [slot](https://docs.polymorfa.com/ui-kit/appearance#slots), typed `SlotClassNames`), appearance variables and element styles. The Style panel applies changes to the live component. See [Appearance](https://docs.polymorfa.com/ui-kit/appearance).

## Setup

Use [the provider and server route](https://docs.polymorfa.com/ui-kit/setup) for your application. The preview above uses local sample data and controllers. [Chat controllers](https://docs.polymorfa.com/ui-kit/chat#controllers) and [inbox data sources](https://docs.polymorfa.com/ui-kit/inbox#data-sources) keep your data separate from the UI.
