Skip to content

API Reference: Generate

James edited this page Mar 8, 2022 · 3 revisions

The generate function is used to, you guessed it, generate a modal & display it on the page. Under the hood it also handles bindings to remove the modal, as well as how to proceed in the event of a confirm button click.

Below is the current table of contents for the generate function.

Key Description Type Default value
title This is the text that displays at the top of the modal in a h3 tag. string ''
description Provides a short description as to what you want the user to accomplish in this modal, output in p tags. string ''
removeText The button text assigned to the cancel, or fail state button, the user will click this when they just want to close the modal. string 'Cancel'
addText The button text assigned to the approve action, or the action used when the user agrees with the statements in the modal. string ''
mainContent This key is free text, you may wish to add form elements here, that you can then go on to make use of in the callback function. string ''
callback The name of the function you wish to run when the user clicks the approve button. method null
params This is an object of parameters you wish to provide to the callback function. object {}
initiatorButton The DOM node of the button clicked in-order to open the modal, used by the remove method to return focus to the button the user originally clicked to open the modal. Dom Node null

Clone this wiki locally