-
Notifications
You must be signed in to change notification settings - Fork 83
Using Input API
Daniel Hindi edited this page May 16, 2019
·
16 revisions
The Input API is a framework that allows your plugin to show a full-size view with multiple inputs to get user input data.
buildfire.input.showTextDialog(options, callback)
Options Object | [Object]
-
placeholder- Will be used as the input's placeholder. -
saveText- Will be used to complete the input and go to next step. -
cancelText- Will be used to cancel the input and return. -
doneText- Will be used when there are multiple steps and you have reached the end. Defaults tosaveText. -
maxLength- set max length of input allowed. -
defaultValue- set pre-existing value of the input. Usually used during edits. -
attachments- Object specifying which attachments to enable-
imagesObject{ enable: Boolean, multiple: Boolean }
-
Callback Function
(err, data) => { ... }
-
err- If the options are invalid you will receive an error -
data- An object with theresults[]and acancelledproperty that can be true/false. If the input dialog was cancelled, the results array will contain up to where the user reached.- results is an array of the result of each step.
Each result can contain the following properties depending on what was enabled
-
textValue- Text value the user entered -
images- Array of image urls
data = {
cancelled: false,
results: [
{ textValue: "...", images: [] }
]
}
Some times you want the user to enter multiple things in order. To do this you can pass multiple option objects in an array.
Example
const steps = [options1, options2, options3];
buildfire.input.showTextDialog(steps, callback);
