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

CallSurface

Props, styling and a live CallSurface example.

View as Markdown
CallSurface
Sample data
@polymorfa/react

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.

CallSurfaceExample.jsx
npm install @polymorfa/react@dev @polymorfa/browser@dev
import { 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 | undefined

    Resolve a display name for a number (contact lookup).

  • resolveAvatarAvatarResolver

    Resolve an avatar URL for a number (sync or async).

    Default Colored initials

  • disableVideoboolean

    Hide the camera control even when the call can carry video.

    Default false

  • popoutboolean

    Offer the ↗ pop-out window button. Defaults to true.

    Default true

  • renderMediaCallStageProps["renderMedia"]

    Replace the stage's media region without forking state.

  • exclusiveboolean

    Claim calls answered from this surface. Default false: other participants keep ringing and can join.

    Default false

  • showParticipantsboolean

    Show the participant list during a call. Defaults to true.

    Default true

  • showLeaveboolean

    Show 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

  • controllerCallsController

    Calls state.

  • createController() => CallsController

    Factory for a controller the component owns.

Types#

Named types used in the props above.

@polymorfa/react
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.