CallSurface
Props, styling and a live CallSurface example.
Customize
Resolve a display name for a number (contact lookup).
Resolve an avatar URL for a number (sync or async).
Hide the camera control even when the call can carry video.
Offer the ↗ pop-out window button. Defaults to true.
Replace the stage's media region without forking state.
Claim calls answered from this surface. Default `false`: other participants keep ringing and can join.
Show the participant list during a call. Defaults to true.
Show the Leave button; see {@link CallControlsProps.showLeave}.
Label for a remote video tile.
npm install @polymorfa/react@dev @polymorfa/browser@devimport { PolymorfaProvider, CallSurface } from "@polymorfa/react";
const appearance = { theme: "light", variables: { colorPrimary: "#635bff" } };
export function CallSurfaceExample({ calls }) {
return (
<PolymorfaProvider tokenEndpoint="/api/polymorfa/token" appearance={appearance}>
<CallSurface
controller={calls}
disableVideo={false}
popout={false}
exclusive={false}
showParticipants
showLeave
/>
</PolymorfaProvider>
);
}CallSurface from @polymorfa/react. Choose props and styles above; the preview stays visible in every code view.
Props#
resolveName(peer: string) => string | undefinedResolve a display name for a number (contact lookup).
resolveAvatarAvatarResolverResolve an avatar URL for a number (sync or async).
Default Colored initials
disableVideobooleanHide the camera control even when the call can carry video.
Default
falsepopoutbooleanOffer the ↗ pop-out window button. Defaults to true.
Default
truerenderMediaCallStageProps["renderMedia"]Replace the stage's media region without forking state.
exclusivebooleanClaim calls answered from this surface. Default
false: other participants keep ringing and can join.Default
falseshowParticipantsbooleanShow the participant list during a call. Defaults to true.
Default
trueshowLeavebooleanShow the Leave button; see
CallControlsProps.showLeave.Default On calls nobody claimed
labelVideoParticipantVideoGridProps["labelVideo"]Label for a remote video tile.
Default The participant's number or ID
controllerCallsControllerCalls state.
createController() => CallsControllerFactory for a controller the component owns.
Types#
Named types used in the props above.
type AvatarResolver = (peer: string) => string | undefined | Promise<string | undefined>;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.