Skip to Content
Referencesection

<section>

A section of a document, with a title (auto-generated or custom) and content

<section> is a Sectional component that renders a titled block of content. If no <title> is provided, an auto-generated title (e.g. Section 1) is rendered. Inline components such as paragraphs (<p>) and other components can be nested within a <section> to group and order content. Some examples are: another <section>, a <figure>, or a <problem>.

Content can also be added to or removed from a <section> at runtime using the <callAction> addChildren and deleteChildren actions. The same applies to the other sectioning components (such as <subsection>, <paragraphs>, <problem>, <exercise>, and <example>).

Attributes and Properties

Attributes for <section>

Scoring (10)
aggregateScores

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

colorAnswersSeparatelyAdded in 0.7.21

boolean. Default value: false. When section-wide check work is enabled, color each answer based on its own correctness rather than the section's overall credit.

colorCorrectnessAdded in 0.7.4

boolean. Default value: true. Whether to color-code the answers it contains based on correctness.

displayDigitsForCreditAchieved

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

maxNumAttemptsAdded in 0.7.21

integer. Default value: Infinity. Maximum number of times the section-wide check-work button can be submitted. Once reached, all enclosed answers are disabled.

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

showCorrectness

boolean. Default value: true. Whether to display correctness indicators for the answers it contains.

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 (18)
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.

collapsibleAdded in 0.7.21

boolean. Default value: false. Whether the section can be collapsed and expanded.

completedColor

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

completedColorDarkModeAdded in 0.7.21

text. Default value: #1a5e20. Color used to indicate this section has been completed (dark mode). If omitted, the dark-mode color is derived from completedColor when that attribute is explicitly set; otherwise falls back to a dark green that meets WCAG AA contrast for white text.

boolean. Default value: false. Whether the completed color requires full creditAchieved, so that a section holding a hand-graded answer is not colored as completed until an instructor grades it. By default a hand-graded answer counts as completed once a non-blank response has been submitted. Affects only the color, not when a <cascade> advances.

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.

inProgressColorDarkModeAdded in 0.7.21

text. Default value: #3a3a3a. Color used to indicate this section is in progress (dark mode). If omitted, the dark-mode color is derived from inProgressColor when that attribute is explicitly set; otherwise falls back to a dark gray that meets WCAG AA contrast for white text.

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.

notStartedColorDarkModeAdded in 0.7.21

text. Default value: #3a3a3a. Color used to indicate this section has not been started (dark mode). If omitted, the dark-mode color is derived from notStartedColor when that attribute is explicitly set; otherwise falls back to a dark gray that meets WCAG AA contrast for white text.

startOpenAdded in 0.7.21

boolean. Default value: true. Whether the collapsible section starts in the open state.

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 <section name="s">

Scoring (9)
$s.aggregateScores

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

$s.colorCorrectnessAdded in 0.7.22

boolean. Whether the answers this section contains are color-coded by correctness, after combining the attribute with any enclosing section's setting and with whether correctness is shown at all.

$s.displayDigitsForCreditAchieved

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

$s.maxNumAttemptsAdded in 0.7.21

integer. Maximum number of times the section-wide check-work button can be submitted. Once reached, all enclosed answers are disabled.

$s.sectionWideCheckWork

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

$s.showCorrectnessAdded in 0.7.22

boolean. Whether correctness is shown for the answers this section contains, after combining the attribute with any enclosing section's setting and with the activity-wide flag.

$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.collapsibleAdded in 0.7.21

boolean. Whether the section can be collapsed and expanded.

$s.completedColorRequiresCreditAdded in 0.7.26

boolean. Whether the heading bar's completion state is driven by the real creditAchieved rather than by progress, so that a hand-graded answer keeps the section from being colored as completed until an instructor grades it.

$s.creditAchieved

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

$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.numAttemptsLeftAdded in 0.7.21

integer. Remaining number of section-wide submissions before the maximum is reached.

$s.numSubmissionsAdded in 0.7.21

integer. Number of times the section-wide check-work button has been submitted.

$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 (8)
$s.disabled

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

$s.doenetML

text. The DoenetML source code that produced this component.

$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.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: <section> with default title

Within a DoenetML document, default titles for sectional components are auto-numbered. Each sectional component is on the same counter.

A <div> or a <cascade> does not start a count of its own, and neither does an <introduction>, <conclusion> or <statement>. The sectional components inside it are numbered along with the ones beside it, and the count continues after it: in <section><subsection/><div><subsection/></div><subsection/></section> the subsections are numbered 1.1, 1.2 and 1.3. Other containers, such as a <sideBySide>, a <blockQuote>, a <solution> or a list item, number the sectional components inside them from 1. So does a <proof>, which itself takes no place in the count.


Example: <section> with custom title

A custom <section> title is creating by providing a <title> tag within the <section>.


Example: How to create a subsection (and subsubsection)

A subsection is created by nesting a <section> within another <section>; nesting one level deeper creates a subsubsection, and so on. The heading level of each <section> is determined by how deeply it is nested.


Example: equivalent nesting with <subsection> and <subsubsection>

<subsection> and <subsubsection> are equivalent to nesting <section>s to the same depth. Use whichever form makes the intent clearer in the source: nested <section> lets the heading level follow the structure, while <subsection> / <subsubsection> make the intended level explicit at every tag.


Example: named <section> as a parent reference

When reference names are used more than once in the same document, they can be distinguished (when outside their parent component) by attaching the name of the parent component to the reference.

Above, the <section> named treeSection is the parent of the <text> named plant. Therefore, when referencing this specific instance of the component with that name, you should use $treeSection.plant as shown.

Attribute Examples

Attribute Example: includeParentNumber

The includeParentNumber attribute is true by default for the <section> component (and false for other sectional components, such as <problem> and <exercise>). This allows the default numbering system to include the number of the parent sectional component, followed by the number of the <section>.

If it is preferable to display the section number without the parent section preceding it, set the includeParentNumber attribute to false.


Attribute Example: includeAutoNumber

The includeAutoNumber attribute is false by default for the <section> component. This means that if a section contains a nested <title>, it will not render the default numbering (although it will still be counted in the numbering scheme behind the scenes).

In order to display the section number in addition to the custom <title>, set the includeAutoNumber attribute to true.


Attribute Example: sectionWideCheckWork

The sectionWideCheckWork attribute combines validation for all <answer> components within the <section> under a single “Check Work” button.


Attribute Example: maxNumAttempts

When combined with sectionWideCheckWork, the maxNumAttempts attribute limits how many times the section-wide “Check Work” button can be submitted. The number of attempts remaining is shown next to the button, and once the attempts are exhausted, all <answer> components within the <section> become disabled.


Attribute Example: colorAnswersSeparately

Typically, the sectionWideCheckWork attribute causes all answer box border colors to correspond to the overall correctness of the entire section (i.e., the colors don’t reveal additional information about which answer is correct). If colorAnswersSeparately is also specified, then each answer box border will instead be colored according to its own answer’s correctness.


Attribute Example: completedColorRequiresCredit

A handGraded <answer> scores no credit until an instructor grades it, which happens after the learner has finished. By default the title banner does not wait for that: such an answer counts as completed as soon as the learner submits a response that is not blank, so answering both questions above turns the first banner green.

The second section sets completedColorRequiresCredit, which opts out of that. Its banner stays gray no matter what the learner submits, and turns green only once an instructor has given the hand-graded answer credit. The attribute is inherited by every section nested inside the one that sets it, so an instructor who wants this throughout an activity can set it once on the outermost section.

The attribute changes the color and nothing else. Both sections report the same creditAchieved, and in a <cascade> both would reveal the next step alike.

Both sections above set aggregateScores, without which a plain <section> does not roll up the credit of the answers it contains and so never leaves its not-started color. A <cascade> turns that on for its children automatically, and the problem-flavored sections — <problem>, <exercise>, <question> and <activity> — have it on by default. Everywhere else, <section> and <aside> and the rest, it has to be spelled out.


Attribute Example: boxed

The boxed attribute changes the default formatting for section to one that has a border and a shaded banner for the title.


Attribute Example: collapsible

The collapsible attribute makes a <section> collapsible — clicking the title banner toggles the section open or closed. By default a collapsible section starts expanded; set startOpen="false" to have it start collapsed.

(<aside> and <proof> are collapsible and start collapsed by default without setting this attribute.)


Attribute Example: hide

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

Last updated on