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

CallNumberPicker

Props, styling and a live CallNumberPicker example.

View as Markdown
CallNumberPicker
Sample data
@polymorfa/react

Customize

Select the existing Number client; never replace its token or session.

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

CallNumberPickerExample.jsx
npm install @polymorfa/react@dev @polymorfa/browser@dev
import { useState } from "react";
import { PolymorfaProvider, CallNumberPicker } from "@polymorfa/react";

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

export function CallNumberPickerExample({ numbers }) {
  const [numberId, setNumberId] = useState("support");
  return (
    <PolymorfaProvider tokenEndpoint="/api/polymorfa/token" appearance={appearance}>
      <style>{".number-picker { display: grid; gap: 6px; max-width: 320px; }\n.number-picker label { font-size: 13px; font-weight: 600; }\n.number-picker select { height: 40px; padding: 0 12px; border: 1px solid var(--pmfa-color-border); border-radius: var(--pmfa-radius-medium); background: var(--pmfa-color-background); color: var(--pmfa-color-foreground); font: inherit; }"}</style>
      <CallNumberPicker
        numbers={numbers}
        value={numberId}
        disabled={false}
        className="number-picker"
        onChange={(id) => setNumberId(id)}
      />
    </PolymorfaProvider>
  );
}

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

Props#

  • numbersreadonly CallNumberOption[]required

    One option per Number, each with its own Calls client controller.

  • valuestringrequired

    Selected option id.

  • onChange(id: string) => voidrequired

    Select the existing Number client; never replace its token or session.

  • disabledboolean

    Disables the picker.

    Default false

  • classNamestring

    Class for the root.

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.