Text Field (Form)

The text field (type: "text") displays an text box in the modal form() dialog that lets you enter a one-line string.

Text Field Properties

  • type ("text") - specifies the form field type
  • name (string) - the field name that will be displayed above the text box
  • id (string) - the path that specifies the source/target property of the data object
  • disabled (boolean) - makes the text field disabled (inaccessible and read-only); optional
  • cssClass (string) - additional CSS class that will be applied to the form field; optional
  • onValidate (function) - a callback function used to validate the field value; optional

Example

import {Modal} from "@daypilot/modal";

// ...

async function textField() {

  const form = [
    {name: "Name", id: "fullName", type: "text"},
  ];

  const data = {
    fullName: "John Doe"
  };

  const modal = await Modal.form(form, data);
  console.log(modal);

}