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) and Select components based on the question.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 blanket disabled prop.

Parameters

props

The component props.

activity

ActivityResponseDto

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 }))}
/>

On this page