Default
Function: default()
[object Object]
Defined in: app/components/Activity/AnswerQuestionsTile.tsx:38
A dynamic form component that renders a list of activity-specific questions.
Features:
- Polymorphic Inputs: Automatically switches between
Input(text, number, date, checkbox) andSelectcomponents based on thequestion.type. - Localization: Displays question labels in Dutch or English based on the user's locale preference.
- Controlled Inputs: Uses parent-owned answer state, so rerenders never reset in-progress typing.
- Validation Visuals: Appends a red asterisk to labels for mandatory questions.
Parameters
props
The component props.
answers
Record<number, string>
Current answers keyed by question id.
disabled?
boolean = false
If true, prevents user interaction with all input fields.
onChange
(id, value) => void
Callback triggered for each input change.
questions
GetSpecificationQuestionResponseDto[]
The list of question definitions to render.
Returns
Element | null
Component
Example
<AnswerQuestionsTile
questions={activity.specificationQuestions}
answers={formData}
onChange={(id, value) => setFormData((prev) => ({ ...prev, [id]: value }))}
/>