WidgetsEnquiry form

Configure the enquiry form

Every MedosEnquiry option with its type and default, the init, open and close methods, and the MedosEnquiryConfig TypeScript type.

A small surface: a key, where to mount, how it looks, and three callbacks. Want to try options before writing code? Use the playground.

Methods

init(config)

MedosEnquiry.init(config: MedosEnquiryConfig): void

Mounts inline, or opens the modal immediately when mode is "modal".

Required: apiKey. Plus containerId when mounting inline.

open(config?)

MedosEnquiry.open(config?: Partial<MedosEnquiryConfig>): void

Opens the form as a modal, merging the argument into the last-known config. It can be the first call — pass apiKey to it and no init() is needed. Throws if no apiKey has ever been set.

close()

MedosEnquiry.close(): void

Closes the modal and fires onClose.

Options

Core

OptionTypeRequiredDefaultDescription
apiKeystringYes—Your Medos publishable key. See API keys.
mode"modal" | "inline"No"inline"Modal overlays the page; inline mounts into containerId.
containerIdstringFor inline—DOM id the form mounts into.

Appearance

The enquiry widget takes the same theming options as every other Medos widget — built-in theme names and the flat brand shortcuts included.

OptionTypeDefaultDescription
theme"default" | "modern" | MedosTheme | PartialTheme"default"Built-in name, full theme object, or partial override. See Theming.
primaryColorstringFrom themeBrand colour. Hover and active shades are derived automatically.
secondaryColorstringFrom themeSecondary brand colour.
borderRadiusstring | numberFrom themeCorner radius. A number means px.
fontFamilystringFrom themeCSS font stack applied across the form.
fontUrlstring—Stylesheet URL (e.g. Google Fonts) loaded so fontFamily resolves.
fontSize"small" | "medium" | "large""medium"Scales every font size proportionally.
MedosEnquiry.init({
  apiKey: "mk_your_publishable_key",
  mode: "inline",
  containerId: "medos-enquiry",
  theme: "modern",
  primaryColor: "#4f46e5",
});

A hand-authored theme object (PartialTheme) works too.

Callbacks

onSuccess, onError, and onClose. See Callbacks.

Not accepted

Unlike the booking widget and the portal, this widget has no maxWidth, maxHeight, otpChannels, or booking-scope options. Size it with your own container.

MedosEnquiryConfig type

interface MedosEnquiryConfig {
  /** Required. Your publishable key. */
  apiKey: string;

  // mounting
  mode?: "modal" | "inline";
  containerId?: string;

  // appearance
  theme?: "default" | "modern" | MedosTheme | PartialTheme;
  primaryColor?: string;
  secondaryColor?: string;
  borderRadius?: string | number;
  fontFamily?: string;
  fontUrl?: string;
  fontSize?: "small" | "medium" | "large";

  // callbacks
  onSuccess?: (enquiry: EnquirySubmission) => void;
  onError?: (error: Error) => void;
  onClose?: () => void;
}

On this page