Skip to content
Shortcut: /, ⌘K or Ctrl+K

ConnectWhatsAppButton

Props, styling and a live ConnectWhatsAppButton example.

View as Markdown
ConnectWhatsAppButton
Sample data
@polymorfa/react

Customize

`redirect` (default) navigates this tab, `popup` opens a new tab. Open the popup in the click handler so browsers do not block it.

Replaces navigation, for tests and custom flows.

ConnectWhatsAppButtonExample.jsx
npm install @polymorfa/react@dev @polymorfa/browser@dev
import { PolymorfaProvider, ConnectWhatsAppButton } from "@polymorfa/react";

const appearance = { theme: "light", variables: { colorPrimary: "#635bff" } };

export function ConnectWhatsAppButtonExample() {
  return (
    <PolymorfaProvider tokenEndpoint="/api/polymorfa/token" appearance={appearance}>
      <ConnectWhatsAppButton
        target="popup"
      >
        Connect WhatsApp
      </ConnectWhatsAppButton>
    </PolymorfaProvider>
  );
}

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

Props#

  • childrenReactNode

    Button label.

    Default "Connect WhatsApp"

  • onConnect(result: ConnectWhatsAppResult) => void

    Called after the QuickLink is created and opened.

  • onError(error: unknown) => void

    Called when the QuickLink cannot be created.

  • classNamestring

    Root class and slot classes.

  • classNamesSlotClassNames

    Root class and slot classes.

  • target"redirect" | "popup"

    redirect (default) navigates this tab, popup opens a new tab. Open the popup in the click handler so browsers do not block it.

    Default "redirect"

  • open(url: string) => void

    Replaces navigation, for tests and custom flows.

Styling#

Use className, classNames (a class for any slot, typed SlotClassNames), appearance variables and element styles. The Style panel applies changes to the live component. See Appearance.

Setup#

Use the provider and server route for your application. The preview above uses local sample data and controllers. Chat controllers and inbox data sources keep your data separate from the UI.