Skip to content

<astl-true-false>

Statements the student marks true or false, each with its own pair of radio buttons, numbered when there are several. Every statement grades one choice slot answered true or false, so an unanswered statement stays unanswered, never false. The buttons say "True" and "False" in the UI language, or what the author names them ("Tak" / "Nie").

Generated from packages/components/src/true-false/: the manifest, the message catalogs, the editor descriptor and the fixtures.

Property Value
Tag <astl-true-false>
Display block: stands between paragraphs
Graded yes
Slot kinds choice (what they mean)
Element version (v) 1
Message namespace astl.true-false
Editor label True or false

The fixture true-false-basic, played with the English UI and graded in the browser. Try it, then press "Check".

Are these sentences about the Solar System true or false? The Earth orbits the Sun. The Moon is a planet. Mars has two moons.
<astl-doc lang="en">
<astl-true-false id="space">
<astl-prompt>Are these sentences about the <em>Solar System</em> true or false?</astl-prompt>
<astl-statement id="orbit" answer="true">The Earth orbits the Sun.</astl-statement>
<astl-statement id="moon" answer="false">The Moon is a planet.</astl-statement>
<astl-statement id="mars" answer="true">Mars has two moons.</astl-statement>
</astl-true-false>
</astl-doc>

Visibility: public attributes stay in the view, private ones exist only in the answer key (students never get them), derived ones are written by the compiler.

Attribute Meaning
id
public, required
id
Source id, unique in the document. Views carry an opaque id instead. Common to all components.
v
public
integer: >= 1
Element format version. Optional in sources (absent = 1); the compiler always writes the current one. Common to all components.
style-template
public
string
A look by name, from the style templates the host registers (the component scope); it wins over the document's. More: Looks. Common to all components.
scoring
private
scoring mode: all, per-statement
default all
One of the manifest's scoring modes; absent = the manifest's default mode. Inspector: "Scoring". Common to graded components.
points
private
number: 0.01 to 1000
default 1
Points of the element's scoring group. Inspector: "Points". Common to graded components.
true-label
public
string
The author's name for the button that answers "true" ("Yes"), in the content language; both or neither. Inspector: "Name of the “true” button".
false-label
public
string
The author's name for the button that answers "false" ("No"). Inspector: "Name of the “false” button".
Child Meaning
<astl-prompt>
public, inline content
0 to 1 per element
The instruction above the statements.
<astl-statement>
public, inline content
1 to 12 per element
One statement: id is local to the block, answer (private) says whether the statement is true. At most 12, so a block stays readable on a phone; split longer lists into several blocks.
Attributes: id (id, public, required), answer (enum, private, required).

One presentation: this component has no variants.

Pick a mode with the scoring attribute. Default: all. Rules: see Scoring.

Mode Rule
all (default) all-correct: full points only when every slot is correct; feedback shows the group verdict only
per-statement proportional: points times the share of correct slots

Slot kinds it produces: choice.

Reported in the namespace astl.true-false, on top of the document issues. Errors block compiling; warnings do not.

Code Messages
TRUE_FALSE_STATEMENT_EMPTY
error
params id, statement
English: True or false {id}: statement {statement} is empty.
Polish: Prawda czy fałsz {id}: zdanie {statement} jest puste.
TRUE_FALSE_STATEMENT_DUPLICATE
warning
params id, text
English: True or false {id}: two statements say “{text}”.
Polish: Prawda czy fałsz {id}: dwa zdania brzmią „{text}”.
TRUE_FALSE_LABEL_ALONE
error
params id
English: True or false {id}: only one button has its own name. Name both buttons, or neither.
Polish: Prawda czy fałsz {id}: tylko jeden przycisk ma własną nazwę. Nazwij oba przyciski albo żaden.
TRUE_FALSE_LABEL_EMPTY
error
params id
English: True or false {id}: a button name is empty.
Polish: Prawda czy fałsz {id}: nazwa przycisku jest pusta.
TRUE_FALSE_LABEL_TOO_LONG
error
params id, max
English: True or false {id}: a button name is longer than {max, plural, one {# character} other {# characters}}. Shorten it.
Polish: Prawda czy fałsz {id}: nazwa przycisku ma więcej niż {max, plural, one {# znak} few {# znaki} many {# znaków} other {# znaku}}. Skróć ją.
TRUE_FALSE_LABEL_SAME
error
params id, text
English: True or false {id}: both buttons are called “{text}”, so students cannot tell them apart.
Polish: Prawda czy fałsz {id}: oba przyciski nazywają się „{text}”, więc uczeń ich nie odróżni.

The insert menu lists <astl-true-false> under "Components", where it inserts the default template, and its named starters under "Exercises": whole exercises with sample text in the author's language.

Entry English Polish
Components True or false
The student marks each statement true or false.
Prawda czy fałsz
Uczeń zaznacza przy każdym zdaniu prawdę albo fałsz.
Exercises: true-or-false True or false
Three statements to mark true or false
Prawda czy fałsz
Trzy zdania do oceny: prawda czy fałsz
Templates of astl-true-false

As the descriptor writes them: {{id}} becomes a fresh id, {{t:key}} a message in the author's locale.

Default template:

<astl-true-false id="{{id}}"><astl-prompt>{{t:template.prompt}}</astl-prompt><astl-statement id="s1" answer="true">{{t:template.statement1}}</astl-statement><astl-statement id="s2" answer="false">{{t:template.statement2}}</astl-statement></astl-true-false>

Named starter true-or-false:

<h3>{{t:template.tf.heading}}</h3><p>{{t:template.tf.instruction}}</p><astl-true-false id="{{id}}"><astl-statement id="s1" answer="true">{{t:template.tf.statement1}}</astl-statement><astl-statement id="s2" answer="false">{{t:template.tf.statement2}}</astl-statement><astl-statement id="s3" answer="true">{{t:template.tf.statement3}}</astl-statement></astl-true-false>
  • Pattern: one radio group per statement, named by its number and the statement.
  • Keys: Tab, ArrowDown, ArrowUp, ArrowRight, ArrowLeft, Space.

What every element must keep: Accessibility.

CSS parts: true-false, prompt, statement, option, control, verdict, solution. How to reach them: Looks.

Authors pick a look for one element with style-template; it wins over the document's. Built-in templates for <astl-true-false>: playful, notebook.

Template Parts it restyles
playful option: box-shadow
notebook prompt: font-family
Property Value
Label True or false (editor.label)
Description The student marks each statement true or false. (editor.description)
Icon toggle-left
Id prefix tf: new elements get tf-1, tf-2, ...

Inspector fields, in order:

Field Edits Label Help
child-choice answer on each <astl-statement> Correct answers
attribute attribute true-label Name of the “true” button For example Yes and No. Leave both empty for True and False.
attribute attribute false-label Name of the “false” button
attribute attribute scoring Scoring
attribute attribute points Points

Every key of astl.true-false: ui.* for students (messages/ui/<locale>.json, the only strings the element loads), issue codes, editor.* and template.* for authors (messages/<locale>.json).

33 keys in English and Polish
Key Messages
ui.hint English: {count, plural, one {Is the statement true or false?} other {Decide for each statement: true or false.}}
Polish: {count, plural, one {Oceń zdanie: prawda czy fałsz.} few {Oceń każde zdanie: prawda czy fałsz.} many {Oceń każde zdanie: prawda czy fałsz.} other {Oceń każde zdanie: prawda czy fałsz.}}
ui.hintNamed English: {count, plural, one {Choose “{yes}” or “{no}”.} other {For each statement, choose “{yes}” or “{no}”.}}
Polish: {count, plural, one {Wybierz „{yes}” albo „{no}”.} few {Przy każdym zdaniu wybierz „{yes}” albo „{no}”.} many {Przy każdym zdaniu wybierz „{yes}” albo „{no}”.} other {Przy każdym zdaniu wybierz „{yes}” albo „{no}”.}}
ui.true English: True
Polish: Prawda
ui.false English: False
Polish: Fałsz
ui.solution English: Correct answer:
Polish: Poprawna odpowiedź:
TRUE_FALSE_STATEMENT_EMPTY English: True or false {id}: statement {statement} is empty.
Polish: Prawda czy fałsz {id}: zdanie {statement} jest puste.
TRUE_FALSE_STATEMENT_DUPLICATE English: True or false {id}: two statements say “{text}”.
Polish: Prawda czy fałsz {id}: dwa zdania brzmią „{text}”.
TRUE_FALSE_LABEL_ALONE English: True or false {id}: only one button has its own name. Name both buttons, or neither.
Polish: Prawda czy fałsz {id}: tylko jeden przycisk ma własną nazwę. Nazwij oba przyciski albo żaden.
TRUE_FALSE_LABEL_EMPTY English: True or false {id}: a button name is empty.
Polish: Prawda czy fałsz {id}: nazwa przycisku jest pusta.
TRUE_FALSE_LABEL_TOO_LONG English: True or false {id}: a button name is longer than {max, plural, one {# character} other {# characters}}. Shorten it.
Polish: Prawda czy fałsz {id}: nazwa przycisku ma więcej niż {max, plural, one {# znak} few {# znaki} many {# znaków} other {# znaku}}. Skróć ją.
TRUE_FALSE_LABEL_SAME English: True or false {id}: both buttons are called “{text}”, so students cannot tell them apart.
Polish: Prawda czy fałsz {id}: oba przyciski nazywają się „{text}”, więc uczeń ich nie odróżni.
editor.label English: True or false
Polish: Prawda czy fałsz
editor.description English: The student marks each statement true or false.
Polish: Uczeń zaznacza przy każdym zdaniu prawdę albo fałsz.
editor.answers English: Correct answers
Polish: Poprawne odpowiedzi
editor.trueLabel English: Name of the “true” button
Polish: Nazwa przycisku „prawda”
editor.falseLabel English: Name of the “false” button
Polish: Nazwa przycisku „fałsz”
editor.labelsHelp English: For example Yes and No. Leave both empty for True and False.
Polish: Na przykład Tak i Nie. Zostaw oba puste, a przyciski będą brzmieć Prawda i Fałsz.
editor.value.answer.true English: True
Polish: Prawda
editor.value.answer.false English: False
Polish: Fałsz
editor.scoring English: Scoring
Polish: Punktacja
editor.value.scoring.all English: All or nothing
Polish: Wszystko albo nic
editor.value.scoring.per-statement English: Points for each statement
Polish: Punkty za każde zdanie
editor.points English: Points
Polish: Punkty
template.prompt English: Type the instruction
Polish: Wpisz polecenie
template.statement1 English: Type a true statement
Polish: Wpisz prawdziwe zdanie
template.statement2 English: Type a false statement
Polish: Wpisz fałszywe zdanie
template.tf.label English: True or false
Polish: Prawda czy fałsz
template.tf.description English: Three statements to mark true or false
Polish: Trzy zdania do oceny: prawda czy fałsz
template.tf.heading English: Nature around us
Polish: Przyroda wokół nas
template.tf.instruction English: Decide whether each sentence is true.
Polish: Zdecyduj, czy każde zdanie jest prawdziwe.
template.tf.statement1 English: The Sun is a star.
Polish: Słońce jest gwiazdą.
template.tf.statement2 English: Whales are fish.
Polish: Wieloryby są rybami.
template.tf.statement3 English: Ice is frozen water.
Polish: Lód to zamarznięta woda.