Skip to content

ChoiceFieldComponentProps

What a Choice component receives: everything every field gets, plus what a Lookup needs. A component written against FieldComponentProps<ChoiceField> alone is still a valid override; it simply ignores these.

disabled: boolean

FieldComponentProps.disabled


error: string | null

A validation message for this field, or null. Render it and reference it via aria-describedby.

FieldComponentProps.error


optional existing?: boolean | null

A Lookup’s companion answer: true picked from the options, false typed, null not answered.


field: ChoiceField

FieldComponentProps.field


id: string

Stable, unique per field — wire this to both the control’s id and its label’s htmlFor.

FieldComponentProps.id


optional lookup?: LookupSource

Searches a Lookup’s options as the respondent types. Absent: the field is a plain text input.


name: string

The field’s raw SubmissionKey — wire this to the control’s name (spec 77-public-form-progressive-enhancement). Deliberately not id: id is scoped to one rendered form instance (${baseId}-${key}), but a native form submission needs name to be the exact key the server expects, with no per-form id-to-key translation required to read it back.

FieldComponentProps.name


onChange: (value) => void

string | number | string[] | null

void

FieldComponentProps.onChange


optional onExistingChange?: (existing) => void

Report the companion answer; the form stores it as <key>-existing.

boolean | null

void


value: string | number | string[] | null

FieldComponentProps.value