ChatiumFor developersPlaygroundPricing
Sign in

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

  1. title: string

    Text describing what kind of input we expect from the user

  2. description: string

    A description clarifying what we expect from the user

  3. placeholder:string

    The text that will appear in place of the value before the user starts typing

  4. multiline: boolean

    Default: false

    Multiline input

  5. inputType: string

    Type of input

    Possible values: string, code

  6. value: string

    Default value

  7. submitData: object

    An object that will extend req.body

  8. submitButtonTitle: string

    Text on the submit button

  9. 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 -->