Referencesubsection

<subsection>

A sectional component nested one heading level deeper than `<section>`

<subsection> is a Sectional component that behaves like <section> — it accepts a custom <title> or falls back to an auto-generated name and number — and is typically used inside a <section>.

A <subsection> is equivalent to nesting a <section> inside another <section>: a <section>’s heading level is determined by how deeply it is nested, so the second level can always be written as either <subsection> or a nested <section>. Use whichever form makes the intent clearer.

Attributes and Properties

Attributes for <subsection>

Scoring (9)
aggregateScores

boolean. Default value: false. Whether to aggregate scores of scored descendants into a section credit-achieved value.

colorCorrectness

boolean. Default value: false. Whether to color-code answers in this section based on correctness.

displayDigitsForCreditAchieved

integer. Default value: 3. Number of significant digits to display for the section's credit achieved value.

forceIndividualAnswerColoring

boolean. Default value: false. Whether to force per-answer color-correctness even when section-wide check work is enabled.

sectionWideCheckWork

boolean. Default value: false. Whether to show a single section-wide check-work button instead of per-answer buttons.

showCorrectness

boolean. Default value: false. Whether to display correctness indicators for answers in this section.

submitLabel

text. Default value: Check Work. Label for the section-wide submit button when correctness is shown.

submitLabelNoCorrectness

text. Default value: Submit Response. Label for the section-wide submit button when correctness is not shown.

weight

number. Default value: 1. Relative weight of this section when aggregated by an enclosing scored section.

Other (12)
asList

boolean. Default value: false. Whether to render this section's children as a list.

boolean. Default value: false. Whether to render this section with a visible box around it.

completedColor

text. Default value: var(--lightGreen). Color used to indicate this section has been completed.

includeAutoName

boolean. Default value: false. Whether to include the auto-generated section name (e.g. "Section") in the rendered title.

includeAutoNameIfNoTitle

boolean. Default value: true. Whether to include the auto-generated name when no explicit title is provided.

boolean. Default value: false. Whether to include the auto-generated section number in the rendered title.

includeAutoNumberIfNoTitle

boolean. Default value: true. Whether to include the auto-generated number when no explicit title is provided.

boolean. Default value: true. Whether to prefix this section's number with the parent section's number.

inProgressColor

text. Default value: var(--mainGray). Color used to indicate this section is in progress.

level

integer. The heading level for this section (overrides the default level inferred from nesting).

noAutoTitle

boolean. Default value: false. Whether to suppress the auto-generated title entirely.

notStartedColor

text. Default value: var(--mainGray). Color used to indicate this section has not been started.

Common to all components (9)
copy

reference. Create an independent copy of another component by reference. Enter a references a $name.

disabled

boolean. Default value: false. Whether this component is disabled and cannot be interacted with.

extend

reference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.

fixed

boolean. Default value: false. Whether this component's value is fixed and cannot be modified.

fixLocation

boolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

boolean. Default value: false. Whether to hide this component from the rendered output.

isResponse

boolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.

name

text. The name used to reference this component from elsewhere in the document.

styleNumber

integer. Default value: 1. The style number used to select this component's visual styling from the available style definitions.

Properties for <subsection name="s">

Scoring (6)
$s.aggregateScores

boolean. Whether scores of scored descendants are aggregated into this section's credit value.

$s.displayDigitsForCreditAchieved

integer. Number of significant digits to display for the section's credit achieved value.

$s.sectionWideCheckWork

boolean. Whether to show a single section-wide check-work button instead of per-answer buttons.

$s.submitLabel

text. Label for the section-wide submit button when correctness is shown.

$s.submitLabelNoCorrectness

text. Label for the section-wide submit button when correctness is not shown.

$s.weight

number. Relative weight of this section when aggregated by an enclosing scored section.

Other (17)
$s.asList

boolean. Whether to render this section's children as a list.

$s.boxed

boolean. Whether this section is rendered with a visible box around it.

$s.creditAchieved

number. Aggregate credit achieved (between 0 and 1) for scored descendants of this section.

$s.disabled

boolean. Whether this component is disabled and cannot be interacted with.

$s.fixed

boolean. Whether this component's value is fixed and cannot be modified.

$s.fixLocation

boolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

$s.hidden

boolean. Whether this component is hidden from the rendered output.

$s.includeAutoName

boolean. Whether to include the auto-generated section name (e.g. "Section") in the rendered title.

$s.includeAutoNameIfNoTitle

boolean. Whether to include the auto-generated name when no explicit title is provided.

$s.includeAutoNumber

boolean. Whether to include the auto-generated section number in the rendered title.

$s.includeAutoNumberIfNoTitle

boolean. Whether to include the auto-generated number when no explicit title is provided.

$s.includeParentNumber

boolean. Whether to prefix this section's number with the parent section's number.

$s.noAutoTitle

boolean. Whether to suppress the auto-generated title entirely.

$s.open

boolean. Whether this section is currently open (for collapsible sections).

$s.percentCreditAchieved

number. Aggregate credit achieved as a percentage (between 0 and 100).

$s.sectionNumber

text. The displayed number for this section.

$s.title

text. The displayed title text for this section.

Common to all components (4)
$s.doenetML

text. The DoenetML source code that produced this component.

$s.hide

boolean. Whether to hide this component from the rendered output.

$s.isResponse

boolean. Whether this component is treated as a response for the purposes of assessment.

$s.styleNumber

integer. The style number used to select this component's visual styling from the available style definitions.

Examples

Example: <subsection> inside a <section>

Each <subsection> is rendered at a deeper heading level than its containing <section> and is counted on the same sectional counter as other subsections at that level.


Example: <subsection> with default (auto-generated) title

When a <subsection> has no <title>, an auto-generated title (e.g. Section 1.1) is rendered. By default, the parent section’s number is included as a prefix.

Attribute Examples

Attribute Example: includeParentNumber

The includeParentNumber attribute is true by default for <subsection> (matching <section>). Set it to false to display the subsection number without the parent section number preceding it.


Attribute Example: includeAutoNumber

The includeAutoNumber attribute is false by default. This means that if a subsection contains a nested <title>, the default numbering is not rendered (although it is still counted behind the scenes). Set includeAutoNumber="true" to display both the number and the custom title.


Attribute Example: boxed

The boxed attribute changes the default formatting to a border with a shaded title banner.


Attribute Example: hide

The hide attribute takes a boolean as input and can be used with any rendered component.