openDialog(name)

Opens a dialog in which the React component with the given name is rendered.

The given React component must have been registered as a Scrivito extension. If the Scrivito UI is not present, calling this function has no effect.

Copy
Scrivito.openDialog("SiteSettingsDialog");

Params

  • name (String) – Name of the React component to be displayed in the dialog, e.g. SiteSettingsDialog.

Example: Dialog for editing the Google Analytics key

Copy
Scrivito.registerComponent("SiteSettingsDialog", () => {
  return (
    <Scrivito.ContentTag
      content={Scrivito.getClass("SiteSettings")
        .all()
        .first()}
      attribute="googleAnalyticsKey"
    />
  );
});

Scrivito.openDialog("SiteSettingsDialog");

For a comprehensive example on how to integrate custom dialogs into Scrivito’s user interface, see Using Custom Dialogs and Menu Items.