import * as React from "react"; import * as System from "~/components/system"; import Group from "~/components/system/Group"; import * as Constants from "~/common/constants"; import SystemPage from "~/components/system/SystemPage"; import ViewSourceLink from "~/components/system/ViewSourceLink"; export default class SystemPageNotifications extends React.Component { _handleCreate = (detail) => { System.dispatchCustomEvent({ name: "create-modal", detail: detail }); }; _handleDelete = () => { System.dispatchCustomEvent({ name: "delete-modal", detail: {} }); }; render() { return ( Modals

The Modal component is used to get a user's focus and require an action.


Imports

Import React and the Modal Component.
{`import * as React from 'react'; import { GlobalModal, dispatchCustomEvent } from 'slate-react-system';`}


Usage

Declare the component at the root level of your document (e.g. in index.js or App.js) so it is accessible throughout and will not get buried in the DOM tree.
Optionally, use backgroundStyle to style the background and style to style the modal itself.
{`class App extends React.Component { render() { return( {this.props.children} ) } }`}


Modal

this._handleCreate({ modal: (
Render whatever component you like here
Cancel
), }) } > Click for modal popup

While the Modal component is always present, a modal will only appear once you trigger it by creating a custom event with the title{" "} "create-modal". It can be removed with a custom event entitled{" "} "delete-modal".
{`class ExampleOne extends React.Component { _handleCreate = (detail) => { dispatchCustomEvent({ name: "create-modal", detail: detail }) }; _handleDelete = () => { dispatchCustomEvent({ name: "delete-modal", detail: {} }); }; render() { let modalContent = (

Render whatever component you like here


Cancel
) return( this._handleCreate({ modal: modalContent }) } > Click for modal popup ) } }`}



Accepted React Properties




Accepted Create Modal Properties

Note that these properties are passed through a custom event rather than as react properties.
modal ), b: "Component", c: "null", d: "Component to be rendered inside the modal", }, ], }} />
); } }