showTextDialog
Show a dialog for text input
Displays a popup message
import {showTextDialog} from '@app/ui'
Properties
options: object
An object with parameters for the input field
submitUrl*: string
The URL to which the text entered by the user will be sent. The text will be available in req.body.value
-
title:
string
Text describing what kind of input we expect from the user
-
description:
string
A description clarifying what we expect from the user
-
placeholder:
string
The text that will appear in place of the value before the user starts typing
-
multiline:
boolean
Default:
false
Multiline input
-
inputType:
string
Type of input
Possible values:
string
,code
-
value:
string
Default value
-
submitData:
object
An object that will extend
req.body
-
submitButtonTitle:
string
Text on the submit button
-
cancelButtonTitle:
string
Text on the cancel button
Examples
Ask the user for their name and greet them
import {showTextDialog, showToast} from '@app/ui'
// Screen
app.screen('/', function(ctx,req) {
return <screen>
<button
onClick={showTextDialog({title:"What is your name?", submitUrl: ctx.router.url('/say')})}
class="secondary"
title="Click"
/>
</screen>
});
// Handler
app.apiCall('/say', async function(ctx,req) {
return showToast("Hello " + req.body.value)
});
<!-- TODO hello button -->