Skip to content

Using Input API

Alex Cavazos edited this page Nov 9, 2018 · 16 revisions

Input API

The Input API is a framework that allows your plugin to show a full-size view with multiple inputs to get user input data.

Usage

buildfire.input.showDialog(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
  • attachments - Object specifying which attachments to enable
    • images Object
      • { enable: Boolean, multiple: Boolean }

Callback Function

(err, data) => { ... }

  • err - If the options are invalid you will receive an error
  • data - An object with the results[] and a cancelled property 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

  • value - Text value the user entered
  • images - Array of image urls
data = {
	cancelled: false,
	results: [
		{ value: "...", images: [] }
	]
}

Multiple Inputs

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.showDialog(steps, callback);

Clone this wiki locally