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

ContactPanel

Props, styling and a live ContactPanel example.

View as Markdown
ContactPanel
Sample data
@polymorfa/react

Customize

Loads the contact. Defaults to the inbox source's `contact()`.

Extra content under the details, such as your CRM fields.

Actions under the name, for example a `<CallButton/>`.

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

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

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

export function ContactPanelExample({ conversation, selectedConversation }) {
  return (
    <PolymorfaProvider tokenEndpoint="/api/polymorfa/token" appearance={appearance}>
      <ContactPanel
        conversation={selectedConversation}
      >
        Customer since 2024
      </ContactPanel>
    </PolymorfaProvider>
  );
}

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

Props#

  • conversationInboxConversationrequired

    Conversation whose contact to show.

  • load(conversation: InboxConversation, signal: AbortSignal) => Promise<InboxContact | undefined>

    Loads the contact. Defaults to the inbox source's contact().

    Default The inbox source's contact()

  • onClose() => void

    Shows a close button.

  • childrenReactNode

    Extra content under the details, such as your CRM fields.

  • actionsReactNode

    Actions under the name, for example a <CallButton/>.

  • 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.