Question type

cardSort

Respondents drag a deck of items into buckets — the runtime stores which item went where. Use it for IA / taxonomy research, mental-model mapping, brand association, feature grouping. Three styles cover predefined buckets (closedSort), respondent-named buckets (openSort), and a seeded mix (hybrid).

What cardSort is

cardSort shows the respondent a deck of items (cards) and a set of slots (buckets). The respondent drags each item into a slot — or, in openSort / hybrid modes, creates and names slots themselves. The runtime stores the mapping { optionCode → slotCode }.

Three styles cover the everyday research patterns:

StyleSlotsRespondent doesBest for
closedSort (default)Predefined in the YAMLPlaces every item into one of your slotsValidation studies, taxonomy testing, classification tasks
openSortNone — respondent createsAdds and names slots, then places itemsDiscovery work — “how do users naturally group these?”
hybridSeeded by you, plus user-addedUses your seeds and adds custom slots if neededSemi-structured exploration with a familiar starting point
QSettingsIA cardSort · closedSort

Group these settings into the categories that make sense to you.

Items to sort
Drag an item to a slot on the right, or click an item then click a slot
Dark mode
Font size
Notifications
Two-factor auth
Cache size
Privacy
Connected accounts
Auto-update
Appearance 2
Dark mode × Font size ×
Notifications 1
Notifications ×
Security & privacy 2
Two-factor auth × Privacy ×
System 0
5 of 8 items sorted

The demo above is a closedSort: four predefined slots, eight items, five already placed for illustration.

Properties

PropertyValuesNotes
qidstringRequired. Unique within the survey.
typecardSortRequired.
title, text, instructionrenderableVisible content. Use {{ }} to pipe runtime values. HTML allowed.
requiredTrue | FalseDefault True.
default.errorsTrue | False | custom stringDefault True.
validationcode blockPython; call fail() to reject. No default.
readonlyTrue | FalseDefault False.
visibilityshow | hideDefault show.
styleclosedSort | openSort | hybridDefault closedSort.
optionsinline coded listRequired. The items to sort. Same numeric-code convention as everywhere else.
slotsinline coded listThe buckets. Required for closedSort, seed for hybrid, omit for openSort.
minintegerMinimum items the respondent must place before Next becomes available. Default: all items for closedSort, 1 for openSort / hybrid.
ifexpressionVisibility / activation condition.
customcode blockCustom runtime block. No default.
Forbidden on cardSort: options.from, group, group.order, scale, scale.from, rows, decimal, decimal.places, label.prefix, label.suffix, input.source, input.size, passage, annotations. The validator rejects any of these on a cardSort question.

Per-item properties

options: entries (the items to sort) carry the same per-option properties as multi’s options.

PropertyNotes
labelRequired when expanding the entry to a map.
specifyTrue — when the respondent places this card into a slot, a free-text input appears on the chip so they can elaborate. Useful for Other items.

Per-slot properties

slots: entries carry slot-level configuration. The slot label shown to the respondent is the entry’s value (or label when expanded).

PropertyNotes
labelDisplay label for the slot. Required when expanding the entry to a map.

Examples

Closed sort — predefined slots

- qid: QSettingsIA
    type: cardSort
    text: Group these settings into the categories that make sense.
    options:
        1: Dark mode
        2: Font size
        3: Notifications
        4: Two-factor auth
        5: Cache size
        6: Privacy
        7: Connected accounts
        8: Auto-update
    slots:
        1: Appearance
        2: Notifications
        3: Security & privacy
        4: System

Default style. Every item must land in one of the four slots before the respondent can advance. The runtime stores the mapping optionCode → slotCode — for example, item 1 (Dark mode) placed into slot 1 (Appearance) shows up as { 1: 1 }.

Open sort — respondent creates slots

- qid: QFeatureSort
    type: cardSort
    style: openSort
    text: Group these features however you find natural. Name each group as you create it.
    min: 6
    options:
        1: Voice search
        2: Live translation
        3: Camera filters
        4: Map directions
        5: Smart calendar
        6: Auto-reply
        7: Trip planning
        8: Receipt scanner
        9: Fitness reminders
QFeatureSort cardSort · openSort

Group these features however you find natural. Name each group as you create it.

Items to sort
Drag an item to a slot on the right, or click an item then click a slot
Voice search
Live translation
Camera filters
Map directions
Smart calendar
Auto-reply
3
Voice search × Live translation × Auto-reply ×
1
Map directions ×
4 of 6 items sorted

No slots: declared. The respondent adds slots themselves and names each one. min: 6 requires at least 6 of the 9 items to be placed before Next is enabled.

The slots a respondent creates appear in the runtime answer state with is_custom: true.

Hybrid sort — seeded slots, respondent can add more

- qid: QPricingPriorities
    type: cardSort
    style: hybrid
    text: Sort these pricing factors by what matters most. You can add your own group if none of the seeded ones fit.
    options:
        1: Monthly fee
        2: Setup cost
        3: Cancellation terms
        4: Hidden fees
        5: Discount for annual billing
        6: Trial period
        7: Refund policy
    slots:
        1: Up-front cost
        2: Ongoing cost
        3: Flexibility

Three slots seeded; the respondent can add custom slots. Useful when the categories are mostly known but you want to capture the edge cases respondents create.

Item with specify

- qid: QFeatureSort
    type: cardSort
    text: Group these features. Tell us what makes the "Other" one stand out.
    options:
        1: Voice search
        2: Live translation
        3: Camera filters
        99:
            label: Other
            specify: True
    slots:
        1: Communication
        2: Visual
        3: Other

When the respondent drags the Other card into a slot, a free-text input appears on the chip — captured per item, exported alongside the placement.

Methods & accessors

cardSort exposes a richer accessor surface than most question types because the answer model is a mapping, not a single selected code.

Question-level

ExpressionReturnsMeaning
Q.answeredboolTrue as soon as at least one item has been placed. The min: property is enforced separately by the progression / submit checks — Q.answered doesn’t gate on it.
Q.notAnsweredboolInverse.
Q.allOptionCollectionAll items, with their placement state. Iterable.
Q.allSlotsSlotCollectionAll slots — including respondent-created ones for openSort / hybrid. Iterable.
Q.option(N)OptionEntryDrill into one item by code.
Q.slot(N)SlotEntryDrill into one slot by code.
Q.reset()—Clear all placements (and any user-created slots).

Item proxy — Q.option(N)

ExpressionReturnsMeaning
Q.option(N).codeCodeThe item’s authored code.
Q.option(N).slotCodeThe slot code this item was placed in. None if unplaced.
Q.option(N).slotLabelstrThe label of that slot (handy for closedSort where it’s authored, useful for openSort where it’s user-typed).
Q.option(N).placedboolTrue if the item has been placed.
Q.option(N).specifystr | NoneThe free-text the respondent typed if the item has specify: True. None when the item has no specify text (either the item doesn’t carry specify: True, or the respondent hasn’t typed anything yet).

Slot proxy — Q.slot(N)

ExpressionReturnsMeaning
Q.slot(N).codeCodeThe slot’s code.
Q.slot(N).labelLabelThe slot’s display label. For openSort slots this is what the respondent typed.
Q.slot(N).optionsOptionCollectionThe items currently placed in this slot.
Q.slot(N).isCustomboolTrue for slots the respondent created (always False on closedSort).

Collection methods (on Q.all, Q.allSlots, .options)

ExpressionReturnsMeaning
.sizeintCount of items / slots in the collection.
.any(predicate)boolTrue if the predicate function returns truthy for any element.
.all(predicate)boolTrue if the predicate function returns truthy for every element.

The .any() / .all() methods on cardSort collections take a function predicate — a callable that’s invoked once per element, returning True / False. They don’t accept the inline-expression form that the standard Q.selected.any([codes]) collection helpers use. For most everyday cases an explicit for loop in a - script: block reads more clearly anyway — see the patterns below.

Patterns

Routing on whether a specific item ended up in a specific slot

- qid: QSettingsIA
    type: cardSort
    options:
        1: Dark mode
        2: Font size
        3: Notifications
        # ...
    slots:
        1: Appearance
        2: Notifications
        3: Security

- qid: QFollowupAppearance
    type: open
    text: You grouped these together as appearance. What ties them together for you?
    if: QSettingsIA.option(1).slot == 1 and QSettingsIA.option(2).slot == 1

Read what’s in a particular slot

# Inside a script — list every item placed in slot 1 (Appearance)
appearance_items = QSettingsIA.slot(1).options
print("Items in Appearance:", appearance_items.size)

Detect whether the respondent created any custom slots (hybrid)

- script: |
    has_custom = False
    for s in QPricingPriorities.allSlots:
        if s.isCustom:
            has_custom = True
            break
    hHasCustomGroup.set(has_custom)

- qid: QFollowup
    type: open
    text: Tell us about the new groups you added.
    if: hHasCustomGroup.value == True

The for-loop in the script computes the flag once and stores it in a hidden helper question; the follow-up’s if: reads that flag. This shape is preferable to threading .any(...) through an inline if: because the .any() predicate is a function, not an inline expression.

Item-level conditional

- qid: QWhyOther
    type: open
    text: Tell us about that "Other" feature you mentioned.
    if: QFeatureSort.option(99).placed and QFeatureSort.option(99).specify != None

Q.option(99).placed confirms the respondent placed the Other card; .specify reads the free-text they typed in the specify input. .specify is None when the respondent hasn’t typed anything (or when the item doesn’t carry specify: True at all).

Export

cardSort exports as one column per item, with the slot code the item ended up in as the value. Items not placed export as null.

ColumnPatternExample
One per itemqidNQSettingsIA1 = 10, QSettingsIA2 = 10, …
Specify text per item with specify: TrueqidNSpecQFeatureSort99Spec = "the camera one"
Slot label (when user-named in openSort / hybrid)qidNSlotLabelQFeatureSort1SlotLabel = "Communication helpers"

For openSort and hybrid, slot codes for user-created slots are generated by the runtime — they don’t collide with the codes you authored on slots:.

See also

  • rank — when ordering items rather than grouping them
  • multi — when items map to a flat selection rather than into buckets
  • Choices & domains — options: and slots: are coded lists with the same per-option override surface
  • Collections — .any() / .all() on Q.allSlots and Q.all