Skip to content

Associate Interaction

Associate interactions let candidates create associations between options from the same set, up to the interaction’s configured match limits.

Install

Terminal window
pnpm add @citolab/prose-qti

The associate interaction is exposed as a subpath export from @citolab/prose-qti, so you import it from @citolab/prose-qti/components/associate and register the custom elements with @citolab/prose-qti/components/associate/register.

The underlying @qti-components/associate-interaction dependency is already pulled in by @citolab/prose-qti, so you do not install anything else for the interaction itself.

Usage

Use the register side effect once, then call the insert command from your editor integration:

import '@citolab/prose-qti/components/associate/register';
import { insertAssociateInteraction } from '@citolab/prose-qti/components/associate';
insertAssociateInteraction(view.state, view.dispatch, view);

What it does

  • Inserts a qti-associate-interaction with editable associable choices.
  • Supports authoring the choice content directly in the editor.
  • Keeps association rules and QTI response semantics attached to the structured interaction node.

Runtime behavior

This package includes runtime ProseMirror behavior for maintaining correct-response state during authoring.

If you assemble your editor through the descriptor registry, include the plugin factories returned by listInteractionPluginFactories() alongside the interaction node specs.