TofuPilotTofuPilot

Text

Display-only text that updates dynamically.

You can create a text display with text:

ui:
  components:
    - key: voltage_reading
      type: text
      label: "Voltage Reading"
      value: "4.987 V"
      size: xl
      color: lime
      font: monospace

Properties

Display

You can configure how the text appears to the operator.

PropertyTypeRequiredDescription
keystringYesUnique identifier for updating the value
typestringYesMust be "text"
labelstringNoDisplay label above the text
descriptionstringNoHelper text displayed below the label
valuestringNoText content to display

Styling

You can customize the text appearance with size, color, and font options.

PropertyTypeRequiredDescription
sizestringNoText size
colorstringNoText color
fontstringNoFont family

Sizes

SizeExample
xsExtra small
smSmall
baseBase (default)
lgLarge
xlExtra large

Colors

ColorExampleColorExampleColorExample
default
zinc
red
orange
yellow
green
lime
sky
blue
violet
purple
pink

Fonts

FontExample
defaultStandard sans-serif font
monospaceMonospace font

Examples

Voltage Measurement Display

We'll display voltage readings with styling for visibility:

phases:
  - name: Voltage Test
    python:
      module: measure_voltage
    ui:
      components:
        - key: voltage_reading
          type: text
          label: "Measured Voltage"
          description: "Live reading from multimeter"
          value: "0.00 V"
          size: xl
          color: lime
          font: monospace
import time

def measure_voltage(run, multimeter):
    for _ in range(10):
        voltage = multimeter.read_voltage()
        run.ui.voltage_reading = f"{voltage:.2f} V"
        time.sleep(0.5)

Status Updates

We'll update status text as operations progress:

phases:
  - name: Long Running Test
    python:
      module: show_status
    ui:
      components:
        - key: status
          type: text
          label: "Status"
          value: "Initializing..."
          color: blue
import time

def show_status(run):
    operations = [
        "Powering on device",
        "Running self-test",
        "Calibrating sensors",
        "Collecting data"
    ]

    for operation in operations:
        run.ui.status = operation
        time.sleep(1)

    run.ui.status = "Complete"

Styled Test Results

We'll use different sizes and colors for visual hierarchy:

phases:
  - name: Test Results
    python:
      module: show_results
    ui:
      components:
        - key: title
          type: text
          value: "Test Results"
          size: xl
          color: blue

        - key: result_status
          type: text
          value: "PASS"
          size: lg
          color: green
          font: monospace

        - key: details
          type: text
          value: "All measurements within spec"
          size: sm
          color: zinc

How is this guide?