Skip to main content
Version: v2.3.0

RankingResponse

Defined in: parser/types.ts:608

The RankingResponse interface is used to define the properties of a ranking widget response. RankingResponses render as a ranking widget with user specified options.

There are three types of ranking widgets: Ranking Sublist: The participant is asked to rank a subset of items from a larger list. Ranking Categorical: The participant is asked to rank items within categories: HIGH, MEDIUM, and LOW. Ranking Pairwise: The participant is asked to rank items by comparing them in pairs.

{
"id": "ranking-sublist",
"type": "ranking-sublist",
"prompt": "Rank your top 2 favorite fruits from the list below",
"location": "belowStimulus",
"options": ["Apple", "Banana", "Orange", "Strawberry", "Grapes"],
"numItems": 2
},
{
"id": "ranking-categorical",
"type": "ranking-categorical",
"prompt": "Sort these hobbies into the categories of HIGH, MEDIUM, and LOW based on your level of interest.",
"location": "belowStimulus",
"options": ["Drawing", "Singing", "Hiking", "Dancing", "Photography"]
},
{
"id": "ranking-pairwise",
"type": "ranking-pairwise",
"prompt": "Which meal would you prefer",
"location": "belowStimulus",
"options": ["Pizza", "Sushi", "Burger", "Pasta", "Salad", "Tacos"]
}

Extends

Properties

PropertyTypeDescriptionInherited fromDefined in
hidden?booleanControls whether the response is hidden.BaseResponse.hiddenparser/types.ts:262
idstringThe id of the response. This is used to identify the response in the data file.BaseResponse.idparser/types.ts:244
infoText?stringThe description that is displayed when the participant hovers over the response. This does not accept markdown.BaseResponse.infoTextparser/types.ts:250
location?ConfigResponseBlockLocationControls the response location. These might be the same for all responses, or differ across responses. Defaults to belowStimulusBaseResponse.locationparser/types.ts:254
numItems?numberThe number of items to rank. Applies only to sublist and categorical ranking widgets.-parser/types.ts:613
options(string | StringOption)[]The options that are displayed as ranking options, provided as an array of objects, with label and value fields.-parser/types.ts:611
paramCapture?stringUse to capture querystring parameters in answers such as participant_name. See the examples for how this is used, but prefer uiConfig.urlParticipantIdParam if you are capturing a participant ID.BaseResponse.paramCaptureparser/types.ts:260
promptstringThe prompt that is displayed to the participant. You can use markdown here to render images, links, etc.BaseResponse.promptparser/types.ts:246
required?booleanControls whether the response is required to be answered. Defaults to true.BaseResponse.requiredparser/types.ts:252
requiredLabel?stringYou can provide a required label, which makes it so a participant has to answer with a response that matches label.BaseResponse.requiredLabelparser/types.ts:258
requiredValue?unknownYou can provide a required value, which makes it so a participant has to answer with that value.BaseResponse.requiredValueparser/types.ts:256
secondaryText?stringThe secondary text that is displayed to the participant under the prompt. This does not accept markdown.BaseResponse.secondaryTextparser/types.ts:248
style?StylesYou can set styles here, using React CSSProperties, for example: {"width": 100} or {"width": "50%"}BaseResponse.styleparser/types.ts:270
stylesheetPath?stringThe path to the external stylesheet file.BaseResponse.stylesheetPathparser/types.ts:268
type"ranking-sublist" | "ranking-categorical" | "ranking-pairwise"--parser/types.ts:609
withDivider?booleanRenders the response with a trailing divider. If present, will override the divider setting in the components or uiConfig.BaseResponse.withDividerparser/types.ts:264
withDontKnow?booleanRenders the response with an option for "I don't know". This counts as a completed answer for the validation.BaseResponse.withDontKnowparser/types.ts:266