The single choice question is used when the current question has a type
property with the value of singleChoice
.
It works like the select
element, providing choices for the user to choose from as an answer.
See questions object to learn more about question types the library supports.
The behavior of this question can be defined with the following props.
Prop | Description | Type |
---|---|---|
text (required) |
The question heading. | String |
choices (required) |
The choices for the user to choose from. | Array |
description |
The question description. | String |
next |
Reference to the next question. | String |
min (default = 0) |
The minimum character value the question should accept. | |
max (default = 10,000) |
The maximum character value the question should accept. | |
other |
Whether the user can provide an ‘other’ option that isn’t included in the options. |
{
type:'singleChoice',
text:`So what type of project are we looking at?`,
description: `This would be a description.`,
choices:[
`Choice 1`,
`Choice 2`,
`Choice 3`
],
other:true,
required:true,
},