TofuPilotTofuPilot

Radio

Prompt operator with single selection from mutually exclusive options.

You can create a radio component with radio:

ui:
  components:
    - key: voltage
      type: radio
      label: "Power Supply Voltage"
      description: "Select the test voltage"
      required: true
      options: 
        - label: "3.3V"
          value: "3.3"
        - label: "5.0V"
          value: "5.0"

Properties

Display

You can configure how the radio component appears to the operator.

PropertyTypeRequiredDescription
keystringYesUnique identifier for accessing the value
typestringYesMust be "radio"
labelstringNoDisplay label for the radio component
descriptionstringNoHelper text displayed below the radio component

Value

You can set default values and bind to measurements or unit properties.

PropertyTypeRequiredDescription
default_valuestringNoDefault selected option value
bindstringNoBind to unit property or measurement. See Collect Input for details.

Options

You can define the list of mutually exclusive choices.

PropertyTypeRequiredDescription
optionsarrayYesArray of objects with label and value properties

Each option object has:

PropertyTypeDescription
labelstringText displayed to the operator
valuestringValue submitted when selected

Validation

You can validate selection before the value is submitted.

PropertyTypeRequiredDescription
requiredbooleanNoIf true, operator must select an option (shows "Required" badge)

TofuPilot validates operator input before submission, preventing continuation until all constraints are met. For some workflows, this input validation can create workarounds where operators bypass the UI to proceed.

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

Test Mode Selection

We'll let the operator choose between different test modes:

phases:
  - name: Configure Test
    ui:
      components:
        - key: test_mode
          type: radio
          label: "Test Mode"
          required: true
          options: 
            - label: "Quick Test (30s)"
              value: "quick"
            - label: "Standard Test (2min)"
              value: "standard"
            - label: "Thorough Test (5min)"
              value: "thorough"

Quality Level

We'll collect quality assessment from the operator:

phases:
  - name: Quality Assessment
    ui:
      components:
        - key: quality_level
          type: radio
          label: "Quality Level"
          description: "Assess the overall quality"
          required: true
          options: 
            - label: "Excellent"
              value: "excellent"
            - label: "Good"
              value: "good"
            - label: "Acceptable"
              value: "acceptable"
            - label: "Poor"
              value: "poor"

How is this guide?