← Element library

Math

Math Templated

Type math answers into blanks in a template.

Delivery

Respond, review and evaluate

Authoring

Visual editor available

Print

Print view available

A word problem in which 24 students, choosing between Store A and Store B, each buy 2 binders and 5 notebooks with $420 to spend, followed by the questions "If the unit price of a notebook in Store A is $1.50, what is the unit price of a binder?" and "If the unit price of a binder in Store B is $2.80, what is the unit price of a notebook?", each with an empty answer box after a dollar sign.
Math Templated example

Try the interaction

Live example: @pie-element/math-templated@8.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": {
    "math-templated": "@pie-element/math-templated@8.0.4"
  },
  "markup": "<math-templated id=\"example\"></math-templated>",
  "models": [
    {
      "id": "example",
      "element": "math-templated",
      "rationale": "Rationale",
      "partialScoring": true,
      "prompt": "There are 24 students in the class. They had the choice to buy supplies from two different stores, Store A and B. Each of them bought 2 binders and 5 notebooks. The students have a total of $420 to spend.",
      "scoringType": "auto",
      "feedbackEnabled": false,
      "promptEnabled": true,
      "rationaleEnabled": true,
      "teacherInstructionsEnabled": true,
      "studentInstructionsEnabled": true,
      "toolbarEditorPosition": "bottom",
      "validationDefault": "literal",
      "ignoreOrderDefault": false,
      "allowTrailingZerosDefault": false,
      "teacherInstructions": "These are teacher instructions",
      "customKeys": [],
      "equationEditor": "geometry",
      "markup": "\n    <p>If the unit price of a notebook in Store A is $1.50, what is the unit price of a binder? ${{0}}</p>\n    <p>If the unit price of a binder in Store B is $2.80, what is the unit price of a notebook? ${{1}}</p>\n  ",
      "responses": {
        "0": {
          "allowTrailingZeros": false,
          "answer": "5",
          "id": "1",
          "validation": "symbolic",
          "ignoreOrder": false,
          "alternates": {}
        },
        "1": {
          "allowTrailingZeros": false,
          "answer": "2.38",
          "id": "1",
          "validation": "literal",
          "ignoreOrder": false,
          "alternates": {}
        }
      }
    }
  ]
}

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/math-templated@8.0.6. Example version: 8.0.4. Use the schema matching your content. Schema checks cover data structure; controller validation checks authoring rules.

model fields (27)
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`—
markupstringIndicates markup value; each `{{n}}` is response area `n`—
slateMarkupstringThe markup as the authoring editor holds it, with each response area as a `math_templated` span; the authoring view derives it from `markup` when it is not set—
promptstringIndicates prompt value—
promptEnabledbooleanIndicates if Prompt is enabled—
teacherInstructionsstringIndicates teacher instructions value—
teacherInstructionsEnabledbooleanIndicates if Teacher Instructions are enabled—
rationalestringIndicates rationale value—
rationaleEnabledbooleanIndicates if Rationale is enabled—
spellCheckEnabledbooleanIndicates if Spell Check is enabled for the author—
playerSpellCheckEnabledbooleanIndicates if Player Spell Check is enabled. Not read by the element: the settings panel writes it, and delivery does not apply it—
responsesobjectCorrect responses, keyed by response area index—
equationEditorEquationEditorIndicates what type of editor should be displayed for all the possible responses"8"
customKeysarrayExtra buttons defined by user—
ignoreOrderDefaultbooleanIndicates the default value for ignoreOrder, in case that it's not setfalse
allowTrailingZerosDefaultbooleanIndicates the default value for allowTrailingZeros, in case that it's not setfalse
validationDefaultstringIndicates the default value for validation, in case that it's not set on a response"literal"["literal","symbolic"]
partialScoringbooleanIndicates if partial scoring is enabled; scoring is dichotomous only when it is false—
toolbarEditorPositionstringIndicates the editor's toolbar position which can be 'bottom' or 'top'"bottom"["bottom","top"]
notestringIndicates the note for the answer; a translated default note applies when it is not set—
languagestringIndicates the language of the component Supported options: en, es, en_US, en-US, es_ES, es-ES, es_MX, es-MX—
extraCSSRulesExtraCSSRulesHost-supplied CSS scoped to the element—
scoringTypestringNot read by the element: the demo models carry it—["auto","rubric"]
feedbackEnabledbooleanNot read by the element: the demo models carry it—
studentInstructionsEnabledbooleanNot read by the element: the demo models carry it—

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.—
MathTemplatedResponse
FieldTypeMeaningDefault / values
idstringThe id for the response; the authoring view creates responses without one—
answerRequiredstringThe value for the response's answer—
validationstringIndicates what type of validation should be applied on the response; the model's `validationDefault` applies when it is not set—["literal","symbolic"]
allowTrailingZerosbooleanIndicates the allowance of trailing zeros in expressions; the model's `allowTrailingZerosDefault` applies when it is not set—
ignoreOrderbooleanIndicates if the order of expression elements in literal validation can be ignore; the model's `ignoreOrderDefault` applies when it is not set—
alternatesobjectFor validation type = literal, alternates represents an object with some alternatives for the correct answers, keyed by alternate id—
allowSpacesbooleanNot read by the element: the authoring view sets it on the responses it creates—
ExtraCSSRules
FieldTypeMeaningDefault / values
namesarraySee the named type or the example model.—
rulesstringSee the named type or the example model.—
Open the complete JSON Schema
configuration fields (19)
FieldTypeMeaningDefault / values
ignoreOrderConfigurePropWithEnabledIgnore Order configuration; `enabled` shows the control on each response—
allowTrailingZerosConfigurePropWithEnabledAllow Trailing Zeros configuration; `enabled` shows the control on each response—
partialScoringConfigurePropPartial Scoring configuration—
baseInputConfigurationEditableHtmlConfigurePropBase editable html input configuration regarding plugins that are enabled/disabled E.g. audio, video, image—
promptEditableHtmlPluginConfigureRequiredConfiguration for the prompt; `inputConfiguration` is not read, the prompt editor takes `teacherInstructions.inputConfiguration`—
spellCheckConfigurePropWithEnabledConfiguration for the author's spellcheck; `enabled` is not read—
editSourceConfigurePropWithEnabledConfiguration for edit Source; `enabled` is not read—
playerSpellCheckConfigurePropWithEnabledConfiguration for the player's spellcheck; `enabled` is not read—
teacherInstructionsEditableHtmlPluginConfigureRequiredTeacher Instructions configuration—
rationaleEditableHtmlPluginConfigureRequiredConfiguration for Rationale—
templateEditableHtmlPluginConfigureTemplate configuration—
maxImageWidthConfigureMaxImageDimensionsPropMaximum image width for input fields—
maxImageHeightConfigureMaxImageDimensionsPropMaximum image height for input fields—
mathMlOptionsConfigureMathMLPropConfiguration for editable-html—
languageConfigurePropWithEnabledLanguage configuration—
languageChoicesConfigureLanguageOptionsLanguage choices configuration Only available if language is enabled—
maxResponseAreasnumberMaximum number of response areas—
settingsPanelDisabledbooleanIndicates if the settings panel is not available—
contentDimensionsContentDimensionsDimensions of the authoring container—

Named object types

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)—
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—
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.—
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—
EditableHtmlPluginConfigure
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—
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—
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 (3)
FieldTypeMeaningDefault / values
idstringIdentifier of the session—
elementstringThe element the session belongs to—
answersobjectAnswers per response area, keyed `r0`, `r1`, ... by response area index—

Named object types

MathTemplatedAnswer
FieldTypeMeaningDefault / values
valueRequiredstringSee the named type or the example model.—
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