Skip to main content

Dialog

warning

This component is a work in progress.

Add a dialog component with additional functionalities.

Dialog plugin

Install the Studio SDK plugins package:

npm i @grapesjs/studio-sdk-plugins

To use the Dialog plugin, you need to import it into your project:

import StudioEditor from '@grapesjs/studio-sdk/react';
import '@grapesjs/studio-sdk/style';
import { dialogComponent } from "@grapesjs/studio-sdk-plugins";
// ...
<StudioEditor
options={{
// ...
plugins: [
dialogComponent.init({
block: { category: 'Extra', label: 'My Dialog' }
})
]

}}
/>

Plugin options

PropertyTypeDescription
licenseKey
string

The license key for the plugin. This is optional, only required if the plugin is used outside of Studio SDK.

Example
"your-license-key"
block
object

Block options for the dialog component. See https://grapesjs.com/docs/api/block.html#properties for more information.

Example
{
"category": "Extra",
"label": "Popup"
}

Component properties

PropertyTypeDescription
closeWhenPressingX*
boolean

Whether the dialog should close when pressing the X button.

closeWhenPressingEsc*
boolean

Whether the dialog should close when pressing the Escape key.

openWhenLeavingWindow*
boolean

Whether the dialog should open when leaving the window.

openWhenScrollingToLevel*
string

Whether the dialog should open when scrolling to a specific level.

Example
"500"