← Element library

Matching and ordering

Image Cloze Association

Drag answers onto the matching spots in an image.

Delivery

Respond, review and evaluate

Authoring

Visual editor available

Print

No print view in this package

The placeholder line "This is the question prompt" and a paragraph about a car tire disposal area near a wetland ending "Drag and drop the data labels into the graph to show how this decision will likely affect the number of tire pieces collected from a sample area of the wetland after many years.", above a line graph of tire pieces collected over time with two empty drop zones and the draggable labels "Without tire recycling" and "With tire recycling".
Image Cloze Association example

Try the interaction

Live example: @pie-element/image-cloze-association@11.0.4 · players 1.0.0-beta.5.

Open all examples for this element →

Use it in an item

Map the tag to an exact package version and match the model ID to the markup. The item player loads the views. You can use any frontend framework.

{
  "elements": {
    "image-cloze-association": "@pie-element/image-cloze-association@11.0.4"
  },
  "markup": "<image-cloze-association id=\"example\"></image-cloze-association>",
  "models": [
    {
      "id": "example",
      "element": "image-cloze-association",
      "prompt": "Drag each label onto the matching line.",
      "stimulus": "<p>Both lines start at (0, 0). Line A reaches (6, 8); line B reaches (8, 3). Compare their slopes.</p>",
      "image": {
        "src": "/demo-assets/image-cloze-lines.svg",
        "width": 465,
        "height": 313,
        "scale": false
      },
      "responseAreaFill": "rgba(240,255,224,0.9)",
      "response_container": {
        "wordwrap": true,
        "width": "130px",
        "height": "55px"
      },
      "response_containers": [
        {
          "x": 64.3,
          "y": 1.6,
          "width": "35.70%",
          "height": "23.64%",
          "wordwrap": true,
          "aria_label": "Line A label"
        },
        {
          "x": 64.09,
          "y": 39.62,
          "width": "35.92%",
          "height": "23.32%",
          "wordwrap": true,
          "aria_label": "Line B label"
        }
      ],
      "possible_responses": [
        "<span>Less steep line</span>",
        "<span>Steeper line</span>"
      ],
      "validation": {
        "scoring_type": "exactMatch",
        "valid_response": {
          "score": 1,
          "value": [
            {
              "images": [
                "<span>Steeper line</span>"
              ]
            },
            {
              "images": [
                "<span>Less steep line</span>"
              ]
            }
          ]
        }
      },
      "partialScoring": false,
      "shuffle": true,
      "rubricEnabled": false,
      "imageDropTargetPadding": "2px",
      "responseContainerPadding": "8px"
    }
  ]
}

Embed an item · Embed authoring · Print integration

Responses and scoring

The controller defines scoring for this element. Browser scoring returns one outcome per element. Your application combines those outcomes into an item score and handles trusted server scoring.

Scoring, partial credit and rubrics →

Model, configuration and session reference

The model holds content, configuration controls the editor, and the session holds the response. Fields below come from generated JSON Schemas.

Schema version: @pie-element/image-cloze-association@11.0.6. Example version: 11.0.4. Use the schema matching your content. Schema checks cover data structure; controller validation checks authoring rules.

model fields (46)
FieldTypeMeaningDefault / values
idRequiredstringIdentifier to identify the Pie Element in html markup, Must be unique within a pie item config.—
elementRequiredstringThe html Element tag name: the key in the item config's `elements` map, e.g. "multiple-choice"—
accessibilityCatalogsarrayQTI-aligned accessibility catalogs whose cards dock to content nodes by `data-catalog-idref`—
answerChoiceTransparencybooleanIndicates in answer choices should have a transparent background. Default value is undefined.—
promptstringThe question prompt or item stem—
rationalestringIndicates rationale value; instructors see it in view and evaluate modes—
rationaleEnabledbooleanIndicates if Rationale is enabled. Not read by the element: the rationale shows whenever it is set—
spellCheckEnabledbooleanIndicates if spellcheck is enabled for the author. Default value is true—
teacherInstructionsstringIndicates teacher instructions value; instructors see it in view and evaluate modes—
teacherInstructionsEnabledbooleanIndicates if Teacher Instructions are enabled—
studentInstructionsEnabledbooleanIndicates if Student Instructions are enabled. Not read by the element—
imageImageClozeAssociationImageThe image over which the responses will be dragged—
responseContainersarrayList of the response containers The response containers are the areas where the images are dragged in—
stimulusstringThe question stimulus—
possibleResponsesarrayList of img tags that are the possible responses—
validationImageClozeAssociationValidationThe validation - correct responses, alternate responses and score—
partialScoringbooleanIndicates if the item should use partial scoring—
maxResponsePerZonenumberIndicates how many responses can be placed in a response container1
duplicateResponsesbooleanIndicates if duplicate responses are allowed—
showDashedBorderbooleanIndicates if the response containers should have a dashed border—
rubricEnabledbooleanIndicates if Rubric is enabled—
shufflebooleanIndicates if the possible responses have to be shuffled in the player—
lockChoiceOrderbooleanIndicates that the possible responses keep their authored order even when `shuffle` is set—
languagestringIndicates the language of the component Supported options: en, es, en_US, en-US, es_ES, es-ES, es_MX, es-MX—
uiStyleImageClozeAssociationUiStyleIndicates style options of the component—
responseAreaFillstringIndicates the background color of the response area—
responseContainerPaddingstringIndicates padding of the response container—
imageDropTargetPaddingstringIndicates the padding of the image drop target—
fontSizeFactornumberIndicates font size adjustment factor—
autoplayAudioEnabledbooleanIndicates if the audio for the prompt should autoplay—
autoplayAudioHeldbooleanSet by the player when the host holds autoplay; it outranks `autoplayAudioEnabled`—
completeAudioEnabledbooleanIndicates if the audio should reach the end before the item can be marked as 'complete'—
customAudioButtonCustomAudioButtonIndicates if the audio should be replaced with a custom audio button—
extraCSSRulesExtraCSSRulesHost-supplied CSS scoped to the element—
possible_responsesarraySnake-case form of `possibleResponses`—
response_containersarraySnake-case form of `responseContainers`—
ui_styleImageClozeAssociationSnakeCaseUiStyleSnake-case form of `uiStyle`—
duplicate_responsesbooleanSnake-case form of `duplicateResponses`—
max_response_per_zonenumberSnake-case form of `maxResponsePerZone`1
response_containerobjectNot read by the element: the demo model carries it—
metadataobjectNot read by the element: the demo model carries it—
is_mathbooleanNot read by the element: the demo model carries it—
response_idstringNot read by the element: the demo model carries it—
metadatadistractor_rationalestringNot read by the element: the demo model carries it—
publishedbooleanNot read by the element: imported content carries it—
shuffle_optionsbooleanNot read by the element: imported content carries it; `shuffle` controls shuffling—

Named object types

AccessibilityCatalog
FieldTypeMeaningDefault / values
identifierRequiredstringSee the named type or the example model.—
cardsRequiredarraySee the named type or the example model.—
CatalogCard
FieldTypeMeaningDefault / values
catalogRequiredstringSee the named type or the example model.—
languagestringSee the named type or the example model.—
contentstringSee the named type or the example model.—
payloadCatalogCardPayloadSee the named type or the example model.—
SignLanguageCardPayload
FieldTypeMeaningDefault / values
signLangstringLanguage tag for the signed translation — BCP 47, which admits ISO 639-3 subtags for languages with no 639-1/2 code. "ase" is ASL, matching QTI 3 `xml:lang`. This is the language of the *adaptation*, not the item's base content language (AfA/PNP's `languageOfAdaptation`). The distinction is load bearing: a Spanish item's signed alternate is LSM, not ASL, so `signLang` must never be inferred from the item or assessment content language. Optional, and redundant on almost every card. The card's `language` states the same code and is the only field pie-players resolves a card on — resolution runs before anything knows the card is a signing card, so it can only key on the generic field — and the player falls back to it when this is absent. Author it only where the two differ: a card tagged with the item's content language (`language: 'en-US'`, `signLang: 'ase'`) so resolution reaches it by the default-language rung. The pie-api-aws importer emits `language` alone.—
mediaRequiredMediaAssetRefSee the named type or the example model.—
fragmentMediaFragmentRangeSee the named type or the example model.—
MediaAssetRef
FieldTypeMeaningDefault / values
versionRequirednumberSee the named type or the example model.—
idRequiredstringSee the named type or the example model.—
kindRequiredMediaKindSee the named type or the example model.—
sourcesRequiredarraySee the named type or the example model.—
posterstringSee the named type or the example model.—
thumbnailstringSee the named type or the example model.—
durationSecondsnumberSee the named type or the example model.—
tracksarraySee the named type or the example model.—
transcriptTranscriptRefSee the named type or the example model.—
labelstringSee the named type or the example model.—
descriptionstringSee the named type or the example model.—
langstringLanguage of the asset itself, as authored metadata. Sign-language cards leave it unset: the card's `language` already states the adaptation language, and a second copy is a second thing to keep in agreement.—
MediaSource
FieldTypeMeaningDefault / values
srcRequiredstringSee the named type or the example model.—
typestringMIME type, e.g. "video/mp4".—
widthnumberSee the named type or the example model.—
heightnumberSee the named type or the example model.—
bitratenumberSee the named type or the example model.—
TextTrackRef
FieldTypeMeaningDefault / values
srcRequiredstringSee the named type or the example model.—
kindRequiredstringSee the named type or the example model.—["captions","subtitles","descriptions","chapters","metadata"]
langRequiredstringSee the named type or the example model.—
labelRequiredstringSee the named type or the example model.—
defaultbooleanSee the named type or the example model.—
TranscriptRef
FieldTypeMeaningDefault / values
srcstringSee the named type or the example model.—
htmlstringSee the named type or the example model.—
plainTextstringSee the named type or the example model.—
langstringSee the named type or the example model.—
MediaFragmentRange
FieldTypeMeaningDefault / values
startSecondsRequirednumberSee the named type or the example model.—
endSecondsnumberSee the named type or the example model.—
SpokenAudioCardPayload
FieldTypeMeaningDefault / values
mediaRequiredMediaAssetRefSee the named type or the example model.—
fragmentMediaFragmentRangeSee the named type or the example model.—
ImageClozeAssociationImage
FieldTypeMeaningDefault / values
srcstringThe url of the image—
widthnumberThe width of the image—
heightnumberThe height of the image—
ImageClozeAssociationResponseContainer
FieldTypeMeaningDefault / values
xnumberThe x coordinate of the response container, as a percentage of the image width—
ynumberThe y coordinate of the response container, as a percentage of the image height—
widthstringThe width of the response container, as a percentage of the image width (e.g. `"35.7%"`)—
heightstringThe height of the response container, as a percentage of the image height (e.g. `"23.6%"`)—
ariaLabelstringPlain text that screen readers announce as the response container's name, in place of "Response area {index} of {total}", which an absent or blank label leaves—
aria_labelstringSnake-case form of `ariaLabel`, which imported content carries—
ImageClozeAssociationValidation
FieldTypeMeaningDefault / values
validResponseImageClozeAssociationValidResponseThe valid response—
altResponsesarrayList of alternate responses—
valid_responseImageClozeAssociationValidResponseSnake-case form of `validResponse`, which the controller reads through camelizing every key; the instructor's correct-response session reads only this form—
alt_responsesarraySnake-case form of `altResponses`, which the controller reads through camelizing every key—
ImageClozeAssociationValidResponse
FieldTypeMeaningDefault / values
scorenumberThe score of the response—
valuearrayThe correct images per response container, in response container order—
ImageClozeAssociationContainerResponse
FieldTypeMeaningDefault / values
imagesarrayAn array containing strings that are img tags—
ImageClozeAssociationUiStyle
FieldTypeMeaningDefault / values
possibilityListPositionImageClozeAssociationChoicesPositionPosition of the possible responses relative to the image"bottom"
fontsizestringNot read by the element—
CustomAudioButton
FieldTypeMeaningDefault / values
playImageRequiredstringimage url for the play state—
pauseImageRequiredstringimage url for the pause state—
ExtraCSSRules
FieldTypeMeaningDefault / values
namesarraySee the named type or the example model.—
rulesstringSee the named type or the example model.—
ImageClozeAssociationSnakeCaseUiStyle
FieldTypeMeaningDefault / values
possibility_list_positionImageClozeAssociationChoicesPositionPosition of the possible responses relative to the image"bottom"
fontsizestringNot read by the element—
Open the complete JSON Schema
configuration fields (14)
FieldTypeMeaningDefault / values
baseInputConfigurationEditableHtmlConfigurePropBase editable html input configuration regarding plugins that are enabled/disabled E.g. audio, video, image—
maxImageWidthConfigureMaxImageDimensionsPropMaximum image width for input fields—
maxImageHeightConfigureMaxImageDimensionsPropMaximum image height for input fields—
settingsPanelDisabledbooleanIndicates if the settings panel is not available—
spellCheckConfigurePropWithEnabledConfiguration for the author's spellcheck; `enabled` is not read—
teacherInstructionsEditableHtmlPluginConfigureRequiredTeacher Instructions configuration—
withRubricConfigurePropRubric configuration - only relevant in environments that use pie-player-components—
mathMlOptionsConfigureMathMLPropConfiguration for editable-html—
languageConfigurePropWithEnabledLanguage configuration—
languageChoicesConfigureLanguageOptionsLanguage choices configuration Only available if language is enabled—
contentDimensionsContentDimensionsDimensions of the authoring container—
showPromptbooleanNot read by this element—
promptLabelstringNot read by this element—
settingsPartialScoringbooleanNot read by this element—

Named object types

EditableHtmlConfigureProp
FieldTypeMeaningDefault / values
mathEditableHtmlButtonConfigureSee the named type or the example model.—
audioEditableHtmlButtonConfigureSee the named type or the example model.—
videoEditableHtmlButtonConfigureSee the named type or the example model.—
imageEditableHtmlButtonConfigureSee the named type or the example model.—
customPluginsarrayAn array of objects that determine custom plugins. A custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when the button gets pressed (event).—
blockquoteEditableHtmlButtonConfigureSee the named type or the example model.—
h3EditableHtmlButtonConfigureSee the named type or the example model.—
charactersEditableHtmlButtonConfigureSee the named type or the example model.—
boldEditableHtmlButtonConfigureSee the named type or the example model.—
htmlEditableHtmlButtonConfigureSee the named type or the example model.—
italicEditableHtmlButtonConfigureSee the named type or the example model.—
ol_listEditableHtmlButtonConfigureSee the named type or the example model.—
redoEditableHtmlButtonConfigureSee the named type or the example model.—
strikethroughEditableHtmlButtonConfigureSee the named type or the example model.—
subEditableHtmlButtonConfigureSee the named type or the example model.—
supEditableHtmlButtonConfigureSee the named type or the example model.—
tableEditableHtmlButtonConfigureSee the named type or the example model.—
ul_listEditableHtmlButtonConfigureSee the named type or the example model.—
underlineEditableHtmlButtonConfigureSee the named type or the example model.—
undoEditableHtmlButtonConfigureSee the named type or the example model.—
textAlignEditableHtmlButtonConfigureSee the named type or the example model.—
showParagraphsEditableHtmlButtonConfigureSee the named type or the example model.—
separateParagraphsEditableHtmlButtonConfigureSee the named type or the example model.—
pasteFormattingEditableHtmlButtonConfigureSee the named type or the example model.—
superscriptEditableHtmlButtonConfigureSee the named type or the example model.—
subscriptEditableHtmlButtonConfigureSee the named type or the example model.—
languageCharactersEditableHtmlButtonConfigureSee the named type or the example model.—
responseAreaEditableHtmlButtonConfigureSee the named type or the example model.—
EditableHtmlButtonConfigure
FieldTypeMeaningDefault / values
disabledbooleanIndicates if the plugin is disabled or not—
CustomPlugin
FieldTypeMeaningDefault / values
eventRequiredstringThe name of the custom event. It needs to be valid (only letters, numbers and "_" can be used). The event is emitted with the "PIE-" prefix.—
iconAltRequiredstringThe alt for the custom button icon—
iconTypeRequiredstringThe icon type. Currently, only "SVG" is supported.—
iconRequiredstringThe icon string. Currently, only SVG is supported, so it needs to be a valid svg.—
ConfigureMaxImageDimensionsProp
FieldTypeMeaningDefault / values
teacherInstructionsnumberIndicates the max dimension for images in teacher instructions—
promptnumberIndicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified—
rationalenumberIndicates the max dimension for images in rationale—
ConfigurePropWithEnabled
FieldTypeMeaningDefault / values
settingsbooleanIndicates if the item has to be displayed in the Settings Panel—
labelstringIndicates the label for the item that has to be displayed in the Settings Panel—
enabledbooleanIndicates the value of the item if it affects config-ui (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)—
EditableHtmlPluginConfigureRequired
FieldTypeMeaningDefault / values
settingsbooleanIndicates if the item has to be displayed in the Settings Panel—
labelstringIndicates the label for the item that has to be displayed in the Settings Panel—
inputConfigurationEditableHtmlConfigurePropConfiguration for editable-html—
requiredbooleanIndicates if the item is required and the value cannot be empty—
ConfigureProp
FieldTypeMeaningDefault / values
settingsbooleanIndicates if the item has to be displayed in the Settings Panel—
labelstringIndicates the label for the item that has to be displayed in the Settings Panel—
ConfigureMathMLProp
FieldTypeMeaningDefault / values
mmlOutputbooleanIndicates if model should have mathML output instead of latex—
mmlEditingbooleanIndicates if mathML that's already in model should be editable—
ConfigureLanguageOptions
FieldTypeMeaningDefault / values
labelRequiredstringSee the named type or the example model.—
optionsRequiredarraySee the named type or the example model.—
ConfigureLanguageOptionsProp
FieldTypeMeaningDefault / values
valueRequiredstringValue of the language option—
labelRequiredstringLabel of the language option—
ContentDimensions
FieldTypeMeaningDefault / values
maxHeightstring | numberSee the named type or the example model.—
maxWidthstring | numberSee the named type or the example model.—
minHeightstring | numberSee the named type or the example model.—
minWidthstring | numberSee the named type or the example model.—
Open the complete JSON Schema
session fields (5)
FieldTypeMeaningDefault / values
idstringIdentifier of the session—
elementstringThe element the session belongs to—
answersarrayThe images the learner placed—
selectorstringHow the learner placed the images; the delivery writes `Mouse`—
shuffledValuesarrayPossible responses in the order they were shuffled for this learner, when their order is not locked—

Named object types

ImageClozeAssociationAnswer
FieldTypeMeaningDefault / values
idstringIdentifier of the placement; the instructor's correct-response session leaves it out—
valueRequiredstringThe img tag of the placed possible response—
containerIndexRequirednumberIndex of the response container the image is placed in—
Open the complete JSON Schema

How to use the schemas →

Accessibility and content requirements

PIE targets WCAG 2.2 AA. Provide clear prompts and media alternatives, and test the question with a keyboard and assistive technology. Manual testing is still incomplete; see the coverage notes below.

Accessibility and evidence · Element evidence and manual checks(opens in new tab)

Element package source(opens in new tab) · Example source(opens in new tab) · Snapshot cb30a68f