Text Input
Last updated on October 28, 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 | Fixed text locked before the input and prepended to the recorded value (e.g., "PCB-") |
suffix | string | No | Fixed text locked after the input and appended to the recorded value (e.g., "-REV") |
trim | boolean | No | Remove leading and trailing whitespace from input (default: true) |
The prefix and suffix render as fixed text locked around the input — the operator types only the middle part, and the value recorded through bind is prefix + input + suffix. An input left empty stays empty; it never records a bare prefix.
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 the whole entry must match (anchors optional) |
pattern_message | string | No | Error shown when the entry doesn't match pattern — include an example the operator can copy |
These constraints validate what the operator types — before any prefix/suffix is added — so a pattern never needs to repeat the prefix.
On the CLI, Station runs and the web operator UI, a pattern must match the entire entry, not merely appear somewhere in it: SN-\d{4} accepts SN-0042 and rejects SCRAP SN-0042. Writing the anchors is optional there — [A-Z]{4} and ^[A-Z]{4}$ are the same rule.
A phase can change min_length, max_length, pattern, pattern_message, prefix and suffix while the screen is open, for example a serial format that depends on the product under test. See Update Properties.
These constraints gate the entry, not the test result: a failing entry is refused at submission, but it never fails the run. 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}$"
pattern_message: "SN- followed by 8 digits, like SN-12345678"
required: trueA pattern that reads as a fixed sequence of characters and character sets ("^[A-Z0-9-]+$", "^\\d{4}$", "^SN-\\d{4}$") explains itself: the operator sees the exact offending character, like Remove the space (character 3). Allowed: uppercase letters, digits, - or Character 6 “X” should be a digit. A pattern that branches (alternation, groups, lookaheads) can't, so without a pattern_message the operator only sees Wrong format.
Prefix and Suffix
We'll automatically add prefix or suffix to the submitted value. A scanned or pasted value that already carries the prefix or suffix gets it once, not twice. Text typed by hand is never trimmed: typing PCB-1234 under prefix PCB- records PCB-PCB-1234. For example:
main:
- name: Component Information
ui:
components:
- key: part_number
type: text_input
label: "Component Part Number"
placeholder: "Enter part ID"
bind: unit.part_number
prefix: "PCB-"
# Operator enters "1234" → recorded as "PCB-1234"
- key: firmware_version
type: text_input
label: "Firmware Version"
placeholder: "2.4.1"
bind: measurements.firmware_version
suffix: "-prod"
# Operator enters "2.4.1" → recorded as "2.4.1-prod"
- key: test_reference
type: text_input
label: "Test Reference"
placeholder: "reference-id"
bind: measurements.test_reference
prefix: "TEST-"
suffix: "-REV"
# Operator enters "A1" → recorded as "TEST-A1-REV"How is this guide?
PanelsPreview
Learn how to replace the operator form with your own HTML and SVG screen in TofuPilot, bound to live measurements, components and run state without JavaScript.
Number Input
Prompt the operator to enter a numeric value during test execution using a validated number input field in TofuPilot.