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:
| Style | Slots | Respondent does | Best for |
|---|---|---|---|
closedSort (default) | Predefined in the YAML | Places every item into one of your slots | Validation studies, taxonomy testing, classification tasks |
openSort | None — respondent creates | Adds and names slots, then places items | Discovery work — “how do users naturally group these?” |
hybrid | Seeded by you, plus user-added | Uses your seeds and adds custom slots if needed | Semi-structured exploration with a familiar starting point |
Group these settings into the categories that make sense to you.
The demo above is a closedSort: four predefined slots, eight items, five already placed for illustration.
Properties
| Property | Values | Notes |
|---|---|---|
qid | string | Required. Unique within the survey. |
type | cardSort | Required. |
title, text, instruction | renderable | Visible content. Use {{ }} to pipe runtime values. HTML allowed. |
required | True | False | Default True. |
default.errors | True | False | custom string | Default True. |
validation | code block | Python; call fail() to reject. No default. |
readonly | True | False | Default False. |
visibility | show | hide | Default show. |
style | closedSort | openSort | hybrid | Default closedSort. |
options | inline coded list | Required. The items to sort. Same numeric-code convention as everywhere else. |
slots | inline coded list | The buckets. Required for closedSort, seed for hybrid, omit for openSort. |
min | integer | Minimum items the respondent must place before Next becomes available. Default: all items for closedSort, 1 for openSort / hybrid. |
if | expression | Visibility / activation condition. |
custom | code block | Custom runtime block. No default. |
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.
| Property | Notes |
|---|---|
label | Required when expanding the entry to a map. |
specify | True — 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).
| Property | Notes |
|---|---|
label | Display 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
Group these features however you find natural. Name each group as you create it.
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
| Expression | Returns | Meaning |
|---|---|---|
Q.answered | bool | True 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.notAnswered | bool | Inverse. |
Q.all | OptionCollection | All items, with their placement state. Iterable. |
Q.allSlots | SlotCollection | All slots — including respondent-created ones for openSort / hybrid. Iterable. |
Q.option(N) | OptionEntry | Drill into one item by code. |
Q.slot(N) | SlotEntry | Drill into one slot by code. |
Q.reset() | — | Clear all placements (and any user-created slots). |
Item proxy — Q.option(N)
| Expression | Returns | Meaning |
|---|---|---|
Q.option(N).code | Code | The item’s authored code. |
Q.option(N).slot | Code | The slot code this item was placed in. None if unplaced. |
Q.option(N).slotLabel | str | The label of that slot (handy for closedSort where it’s authored, useful for openSort where it’s user-typed). |
Q.option(N).placed | bool | True if the item has been placed. |
Q.option(N).specify | str | None | The 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)
| Expression | Returns | Meaning |
|---|---|---|
Q.slot(N).code | Code | The slot’s code. |
Q.slot(N).label | Label | The slot’s display label. For openSort slots this is what the respondent typed. |
Q.slot(N).options | OptionCollection | The items currently placed in this slot. |
Q.slot(N).isCustom | bool | True for slots the respondent created (always False on closedSort). |
Collection methods (on Q.all, Q.allSlots, .options)
| Expression | Returns | Meaning |
|---|---|---|
.size | int | Count of items / slots in the collection. |
.any(predicate) | bool | True if the predicate function returns truthy for any element. |
.all(predicate) | bool | True 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.
| Column | Pattern | Example |
|---|---|---|
| One per item | qidN | QSettingsIA1 = 10, QSettingsIA2 = 10, … |
Specify text per item with specify: True | qidNSpec | QFeatureSort99Spec = "the camera one" |
Slot label (when user-named in openSort / hybrid) | qidNSlotLabel | QFeatureSort1SlotLabel = "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:andslots:are coded lists with the same per-option override surface - Collections —
.any()/.all()onQ.allSlotsandQ.all