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:
stringText describing what kind of input we expect from the user
-
description:
stringA description clarifying what we expect from the user
-
placeholder:
stringThe text that will appear in place of the value before the user starts typing
-
multiline:
booleanDefault:
falseMultiline input
-
inputType:
stringType of input
Possible values:
string,code -
value:
stringDefault value
-
submitData:
objectAn object that will extend
req.body -
submitButtonTitle:
stringText on the submit button
-
cancelButtonTitle:
stringText 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 -->