Text Input
Last updated on June 16, 2026
Operator UI: Text Input
Label: Serial Number (required)
Placeholder: SN-001
Help: Enter the unit's serial number to start testingYou can create a text input with text_input:
ui:
components:
- key: serial_number
type: text_input
label: "Serial Number"
placeholder: "SN-001"
description: "Enter the unit's serial number to start testing"
required: trueProperties
Display
You can configure how the input field appears to the operator.
| Property | Type | Required | Description |
|---|---|---|---|
key | string | Yes | Unique identifier for accessing the value |
type | string | Yes | Must be "text_input" |
label | string | No | Display label for the input |
description | string | No | Helper text displayed below the input |
placeholder | string | No | Hint text shown when empty |
Value
You can set default values and bind to measurements or unit properties.
| Property | Type | Required | Description |
|---|---|---|---|
default_value | string | No | Default value to pre-fill the input field |
bind | string | No | Bind to unit property or measurement. See Bind to Measurements for details. |
Modifiers
You can automatically add prefix or suffix to the operator's input when the value is submitted.
| Property | Type | Required | Description |
|---|---|---|---|
prefix | string | No | Text automatically prepended to the submitted value (e.g., "PCB-") |
suffix | string | No | Text automatically appended to the submitted value (e.g., "-REV") |
trim | boolean | No | Remove leading and trailing whitespace from input (default: true) |
Validation
You can validate input format and length before the value is submitted.
| Property | Type | Required | Description |
|---|---|---|---|
required | boolean | No | If true, operator must provide input (shows "Required" badge) |
min_length | number | No | Minimum number of characters required |
max_length | number | No | Maximum number of characters allowed |
pattern | string | No | Regex pattern for format validation |
The web operator UI checks these constraints before submission, but they are not enforced by the execution engine itself, so do not rely on them as pass/fail criteria.
Instead, you can capture the input as a Measurement using Binding and validate it with Validators. TofuPilot will record the actual operator input while enforcing pass/fail criteria.
Examples
Length Validation
We'll enforce character count limits:
main:
- name: Enter Part Code
ui:
components:
- key: part_code
type: text_input
label: "Part Code"
min_length: 3
max_length: 10
required: truePattern Validation
We'll use regex pattern to enforce specific formats:
main:
- name: Collect Serial Number
ui:
components:
- key: serial_number
type: text_input
label: "Serial Number"
placeholder: "SN-12345678"
pattern: "^SN-[0-9]{8}$"
required: truePrefix and Suffix
We'll automatically add prefix or suffix to the submitted value:
main:
- name: Component Information
ui:
components:
- key: part_number
type: text_input
label: "Component Part Number"
placeholder: "Enter part ID"
prefix: "PCB-"
# Operator enters "1234" → Submitted as "PCB-1234"
- key: firmware_version
type: text_input
label: "Firmware Version"
placeholder: "2.4.1"
suffix: "-prod"
# Operator enters "2.4.1" → Submitted as "2.4.1-prod"
- key: test_reference
type: text_input
label: "Test Reference"
placeholder: "reference-id"
prefix: "TEST-"
suffix: "-REV"
# Operator enters "A1" → Submitted as "TEST-A1-REV"How is this guide?