Crease

MixedContent

Will accept both single and multiple correct answers.

Type

export type MixedContent = SingleAnswerContent | MultipleAnswersContent;

Fields

PropTypeDefault
format
"single-answer" | "multiple-answers"
-
question
string
-
options
string[]
-
correctAnswers
number | number[]
-

Example

const content: NonEmptyArray<MixedContent> = [
  {
    format: "multiple-answers",
    question: "Which of these are prime numbers?",
    options: ["-2", "7", "3", "1"],
    correctAnswers: [1, 2]
  },
  {
    format: "single-answer",
    question: "Is the sky blue?",
    options: [
      "Yes",
      "No"
    ],
    correctAnswers: 0
  },
]

More information

correctAnswers: The index (0-based) of the correct answer within the options array.

On this page