Default
Function: default()
[object Object]
Defined in: components/Activity/AnswerQuestionsTile.tsx:51
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.
- Per-question deadlines: Each question is individually disabled once its own answer
deadline (see
isQuestionAnswerable) has passed, regardless of the blanketdisabledprop.
Parameters
props
The component props.
activity
The activity the questions belong to, used to resolve each question's effective answer deadline.
answers
Record<number, string>
Current answers keyed by question id.
disabled?
boolean = false
If true, prevents user interaction with all input fields in addition to any that are locked by their own deadline.
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}
activity={activity}
answers={formData}
onChange={(id, value) => setFormData((prev) => ({ ...prev, [id]: value }))}
/>