A2UI icon indicating copy to clipboard operation
A2UI copied to clipboard

fix(lit): correctly bind TextField type property to enable number inputs

Open SliverKeigo opened this issue 1 week ago • 0 comments

Description

This PR fixes an issue where the TextField component in the Lit renderer was ignoring the type property (e.g., "number") from the A2UI JSON payload.

Problem

A property name mismatch between the renderer and component caused the input type to be ignored:

Location Property Name Code
root.ts (Sender) .type .type=${node.properties.type}
text-field.ts (Receiver) inputType accessor inputType

Result: <input type="number"> rendered as <input type="text">, allowing non-numeric input in number fields.

Solution

  1. Lit Component (text-field.ts): Renamed inputTypetextFieldType to avoid conflicts with the component's class type identifier.

  2. Root Renderer (root.ts): Updated binding to .textFieldType=${node.properties.type}.

  3. Samples (a2ui_examples.py): Added explicit "type": "shortText" and "type": "number" usage for clarity.

Verification

  • textFieldType correctly receives values from JSON payload
  • ✅ HTML input renders with type="number" when specified

Hi @jacobsimionato 👋

Could you please take a look or help arrange a review?

Thanks! 🙏

SliverKeigo avatar Dec 18 '25 07:12 SliverKeigo