Documentation

Ranking Question

When and Why to Use

Use this when you want respondents to rank a list of items in order of preference, importance, or relevance. Ideal for:

  • Brand or product preference
  • Feature prioritization
  • Behavioral comparisons (e.g. activities, habits)

Supports optional min/max number of items to rank, media options, and custom recoding.

Chat Experience
  • Drag-and-drop or tap-to-rank UI depending on style
  • Labels for top and bottom ranks shown as anchors
  • Optional "Don't know" button shown below options
Traditional Experience
  • Grid or stacked ranking interaction optimized for larger viewports
  • Buttons are laid out clearly with visual feedback on order
Chat experienceTraditional Experience with imagesTraditional, mobile optimized, without images
Button 2B Plain TextButton Markdown ImagesRanking Question Figure 01
Configuration Options
OptionTypeRequiredDefaultDescription
questionstringyes-Text shown above the ranking list
optionsList[str | MediaItem]yes-Strings or media items containing the options
imageMediaItemno-Image shown above the question, from the s.media collection
min_optionsintnoallMinimum number of items user must rank
max_optionsintnoallMaximum number of items user may rank
styleLiteral['default', 'button', 'list']no'button'Presentation style for the options: 'default', 'button', or 'list'
labelsTuple[str, str]no("Least", "Most")Anchors for bottom/top of the ranking
randomizeboolnoFalseShuffle item order
fixed_optionsList[str]no-Items that should not be shuffled
other_optionsList[str]no-Additional options to present to the user
skip_emptyboolnoFalseSkip if no items to rank
defaultList[str] | List[List[str]]norandomDefault ranking for test data, or a list of candidate rankings — each simulated respondent picks one at random
recodesDict[str, str]no-Map items to alternative codes for reporting
custom_validatorCallable[[List[str]], str | None]no-Called with the parsed ranking as a plain list of strings; return an error message to reject it, or None to accept
image_label_fieldstrno-Label to use for image-based items
show_image_labelboolnoTrueWhether to show labels with images
image_sizeTuple[int, int]no600x600Size of image tiles
dont_know_optionstrno''Adds a "Don't know" option with this label
number_secondsintno0Seconds to wait before allowing the respondent to continue
tagss.tag()no-Used for token replacement
idstr | NonenoNoneOptional stable identifier for this question
Example Code

Basic usage:

s.ranking_question( "Rank the following car brands in order of preference", options=["Ford", "Toyota", "Honda", "Tesla"], labels=("Least", "Most") )

Ranking a subset with a "Don't know" option:

s.ranking_question( "Rank your top three features", options=["Price", "Design", "Battery life", "Camera", "Durability"], min_options=3, max_options=3, dont_know_option="Don't know" )
Notes
  • Options can be plain strings or media items from the s.media collection; use image_label_field, show_image_label, and image_size to control how image options are labeled and sized
  • min_options and max_options control how many options the respondent must rank; both default to all options
  • Returns a ListResponse containing the ranked options, which behaves like a plain Python list