Median

Support modal

MedianSupportModal, the support widget with its panel centered over the page.

Updated Oct 1, 20262 minute read
import { MedianSupportModal } from "@mediansh/widget";

<MedianSupportModal apiKey="median_pk_..." />;

The launcher stays in the corner. Only the open panel moves to the middle of the screen. The thread, the composer, the email question, unread counts, the unread card, ratings, destinations and the sign in panel all work as they do in the support widget.

What differs from the widget

WidgetModal
Open panelGrows out of the launcherCentered over a dimmed, blurred backdrop
Size28rem wide, 40rem tall50rem wide, 40rem tall
Expand controlExpand the panel grows it to 34rem by 52remNone
Fits inThe window, less 1rem on each sideThe window, less 2rem on each side
Text and composer16px bubbles, a pill composer14px bubbles, a box composer with its buttons underneath
Page behindScrolls and takes clicksDimmed, and scrolling is locked
Press outside the panelNothingCloses
DragThe launcher, or the open panel by its headerThe launcher only
Destination pressThe panel stays openThe panel closes
Stackingz-index: 50z-index: 2147483000, rendered into <body>
Screen readersA section labelled Acme supportA dialog with aria-modal, labelled Acme support
Phones, 40rem wide or lessA full screen sheet that closes on a destination pressThe same sheet

Escape and the close button close both. Focus moves into the panel on open. On close it returns to the launcher, or with launcher="hidden" to the element that opened the panel.

Props

MedianSupportModalProps is MedianSupportProps. Every prop works the same, and none are dropped. The modal keeps the corner launcher, so launcher, messagePreview and titleCount apply too.

<MedianSupportModal
  apiKey="median_pk_..."
  launcher="hidden"
  onNavigate={router.push}
/>;

With launcher="hidden", nothing shows until your code opens the modal.

Open it from your code

useMedianSupport() and medianSupport drive whichever of the two is mounted. See Control from code.

import { useMedianSupport } from "@mediansh/widget";

function HelpLink() {
  const support = useMedianSupport();

  return <button onClick={support.open}>Get help</button>;
}

Mount the modal or the widget, not both. Two share one open state and open together.

Without React

import { mountMedianSupportModal } from "@mediansh/widget";

const support = mountMedianSupportModal({ apiKey: "median_pk_..." });

It takes the same options and returns the same update and unmount as mountMedianSupport. See Without React.

Console messages

The modal prints the widget's messages. They name <MedianSupport>, except the apiKey shape error, which names <MedianSupportModal>, and the no-document error from mountMedianSupportModal(), which names that function.

Still need help?

    Esc