Code

The code input is identical to the text input, but it uses a monospace font to display the content.

Example

({
  type: "code",
  label: "Code",
  placeholder: "Enter your text here...",
})

Options

Input

Use these options when using the field with take.

value?
string
The initial value of the field.
key?
string
A key to access the value. If provided, each field must have a unique key. See make for more information about accessing values.
label?
string
A label describing the purpose of the field.
detail?
string
Additional information about the field, disclosed in a tooltip.
placeholder?
string
Add placeholder text to prompt the user when the field is empty.
spellcheck?
boolean
Enable or disable the browser’s spellchecking feature.
pattern?
string
A regular expression that the input value must match in order for the value to pass validation.
maxlength?
number
The maximum number of characters the user can enter into the input.

Output

Use these options when using the field with make.

value?
string
The output value of the field.
label?
string
A label describing the purpose of the field.
detail?
string
Additional information about the field, disclosed in a tooltip.

Data

Code will always return a string. If the value is null or undefined, an empty string is returned. All other non-string values have their toString() method called before being parsed.