Modal
Reference
- The
Modalcomponent is use for displaying modal dialogs.
Props
-
children- Type:
ReactNode - Description: The content to display inside the modal.
- Type:
-
onClose- Type:
function - Description: Callback function triggered when the modal background is clicked.
- Type:
-
open- Type:
boolean - Description: Controls the visibility of the modal. If
false, the modal is not rendered.
- Type:
-
background- Type:
boolean - Description: If
true, applies a dark background overlay behind the modal.
- Type:
-
zIndex- Type:
string - Description: Customizes the
z-indexof the modal for layering.
- Type:
Usage Example
function Example(pageContext) {
const { protrakComponents } = React.useContext(customWidgetContext);
const { Modal } = protrakComponents;
return(
<Modal
open={true}
onClose={() => console.log('Modal closed')}
background={true}>
<p>This is modal content.</p>
</Modal>
);
}
- This renders a modal with a dark background and logs a message when the background is clicked.