<ionicCompound>
<ionicCompound> is a Subject-specific
component that builds a balanced ionic compound from a cation and an anion and
renders the resulting chemical formula. It automatically determines the
smallest integer subscripts that produce a neutral compound.
Attributes and Properties
Attributes for <ionicCompound>
Other (3)
atomicNumberinteger. The atomic number of an element in the compound.
chargeinteger. The charge of an ion in the compound.
symboltext. The chemical symbol of an element in the compound.
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
disabledboolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether to hide this component from the rendered output.
isResponseboolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. The style number used to select this component's visual styling from the available style definitions.
Properties for <ionicCompound name="i">
Other (10)
$i.backgroundColortext. Human-readable name for this component's background color, derived from the active style and theme.
$i.disabledboolean. Whether this component is disabled and cannot be interacted with.
$i.fixedboolean. Whether this component's value is fixed and cannot be modified.
$i.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
$i.latexlatex. The ionic compound rendered as a LaTeX string.
$i.mathmath. The ionic compound rendered as a math expression of its chemical formula.
$i.texttext. The ionic compound rendered as a plain text string.
$i.textColortext. Human-readable name for this component's text color, derived from the active style and theme.
$i.textStyleDescriptiontext. Human-readable description of this component's text styling (color and any background color).
Common to all components (4)
$i.doenetMLtext. The DoenetML source code that produced this component.
$i.hideboolean. Whether to hide this component from the rendered output.
$i.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$i.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: Two <ion> children
An <ionicCompound> takes exactly two <ion> children — one
cation and one anion. The component computes the simplest whole-number ratio
of the two ions that produces a net charge of zero and renders the resulting
formula with subscripted counts.
Example: Default charges from element symbols
When the <ion> children omit a charge, each ion uses its element’s
most common charge. This makes it convenient to construct binary ionic
compounds from main-group elements with predictable oxidation states.
Example: Use in an answer block
The math property is the most convenient way to use an <ionicCompound>
as the reference answer in an <answer> block, since the student’s
<mathInput/> value can be compared directly.
Property Examples
Property Example: math, latex, text
math is a math expression that can be used in computations, latex is a
LaTeX string suitable for rendering, and text is a plain-text fallback.
Subscripted ion counts appear as _{n} in the LaTeX form.