CallButton
Props, styling and a live CallButton example.
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.
npm install @polymorfa/react@dev @polymorfa/browser@devimport { 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#
tostringrequiredPhone number in E.164 form or a WhatsApp user ID.
videobooleanPlaces a video call.
Default
falsesessionstringSession that places the call. Defaults to the grant's session.
Default The grant's session
variant"button" | "icon"iconrenders a round icon button, as in the inbox header.Default
"button"surfacebooleanRender the call overlay after placing. Defaults to
true.Default
truechildrenReactNodeButton label.
Default Locale text
onError(error: unknown) => voidCalled when placing fails.
classNamestringRoot class and slot classes.
classNamesSlotClassNamesRoot 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.