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

CallButton

Props, styling and a live CallButton example.

View as Markdown
CallButton
Sample data
@polymorfa/react

Customize

Phone number in E.164 form or a WhatsApp user ID.

Session that places the call. Defaults to the grant's session.

`icon` renders a round icon button, as in the inbox header.

Render the call overlay after placing. Defaults to `true`.

React only: @polymorfa/elements has no element for CallButton.

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

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

export function CallButtonExample() {
  return (
    <PolymorfaProvider tokenEndpoint="/api/polymorfa/token" appearance={appearance}>
      <CallButton
        to="+15550001042"
        video={false}
        variant="button"
        surface={false}
      >
        Call Avery
      </CallButton>
    </PolymorfaProvider>
  );
}

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

Props#

  • tostringrequired

    Phone number in E.164 form or a WhatsApp user ID.

  • videoboolean

    Places a video call.

    Default false

  • sessionstring

    Session that places the call. Defaults to the grant's session.

    Default The grant's session

  • variant"button" | "icon"

    icon renders a round icon button, as in the inbox header.

    Default "button"

  • surfaceboolean

    Render the call overlay after placing. Defaults to true.

    Default true

  • childrenReactNode

    Button label.

    Default Locale text

  • onError(error: unknown) => void

    Called when placing fails.

  • classNamestring

    Root class and slot classes.

  • classNamesSlotClassNames

    Root class and slot classes.

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.