<astl-long-answer>
A question the student answers in their own words, for the teacher: one open slot, stored with the attempt and never graded (at most 2000 characters). The box is a native text area labelled by the prompt, with a character counter.
Generated from packages/components/src/long-answer/: the manifest, the message catalogs, the editor descriptor and the fixtures.
| Property | Value |
|---|---|
| Tag | <astl-long-answer> |
| Display | block: stands between paragraphs |
| Graded | no: its answers (open) are stored for the teacher |
| Slot kinds | open (what they mean) |
Element version (v) |
1 |
| Message namespace | astl.long-answer |
| Editor label | Long answer |
Live example
Section titled “Live example”The fixture long-answer-basic, played with the English UI and graded in the browser. Try it, then press "Check".
Our school garden
Your teacher will read what you write. There is no single right answer.
<astl-doc lang="en"> <h2>Our school garden</h2> <p>Your teacher will read what you write. There is no single right answer.</p> <astl-long-answer id="garden"><astl-prompt>What would you grow in the school garden, and <em>why</em>?</astl-prompt></astl-long-answer></astl-doc>Attributes
Section titled “Attributes”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 |
|---|---|
idpublic, required id |
Source id, unique in the document. Views carry an opaque id instead. Common to all components. |
vpublic integer: >= 1 |
Element format version. Optional in sources (absent = 1); the compiler always writes the current one. Common to all components. |
style-templatepublic 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. |
rowspublic integer: 1 to 20 default 5 |
Height of the box in lines; one line makes a single-line answer. Inspector: "Lines in the box". |
minlengthpublic integer: 0 to 2000 |
Fewest characters asked for: the student sees how many more to write. Nothing blocks a shorter answer. Inspector: "Fewest characters". |
maxlengthpublic integer: 1 to 2000 |
Most characters the box takes (2000 without it). Inspector: "Most characters". |
placeholderpublic string |
A hint shown in the empty box, such as how to start. Inspector: "Hint in the empty box". |
Children
Section titled “Children”| Child | Meaning |
|---|---|
<astl-prompt>public, inline content 0 to 1 per element |
The question: the label of the box. Required (LONG_ANSWER_PROMPT_MISSING); the spec is the shared prompt's. |
Variants
Section titled “Variants”One presentation: this component has no variants.
Scoring
Section titled “Scoring”Not graded: its open slots are stored with the attempt for the teacher, get no verdict and add nothing to the maximum (Open answers).
Issue codes
Section titled “Issue codes”Reported in the namespace astl.long-answer, on top of the document issues. Errors block compiling; warnings do not.
| Code | Messages |
|---|---|
LONG_ANSWER_PROMPT_MISSINGerror params id |
English: Long answer {id} has no question: the box needs one as its label. Polish: Długa odpowiedź {id} nie ma pytania, a pole potrzebuje go jako etykiety. |
LONG_ANSWER_LIMITSerror params id, max, min |
English: Long answer {id} asks for at least {min} characters but takes at most {max}. Polish: Długa odpowiedź {id} wymaga co najmniej {min} znaków, a przyjmuje najwyżej {max}. |
Starters
Section titled “Starters”The insert menu lists <astl-long-answer> 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 | Long answer The student writes an answer in their own words, and the teacher marks it. |
Długa odpowiedź Uczeń odpowiada własnymi słowami, a ocenia nauczyciel. |
Exercises: write-your-answer |
Write your answer A question answered in a few sentences, read by the teacher |
Napisz odpowiedź Pytanie, na które uczeń odpowiada kilkoma zdaniami, a czyta je nauczyciel |
Templates of astl-long-answer
As the descriptor writes them: {{id}} becomes a fresh id, {{t:key}} a message in the author's locale.
Default template:
<astl-long-answer id="{{id}}"><astl-prompt>{{t:template.prompt}}</astl-prompt></astl-long-answer>Named starter write-your-answer:
<h3>{{t:template.write.title}}</h3><p>{{t:template.write.instruction}}</p><astl-long-answer id="{{id}}" rows="6" minlength="100" maxlength="800" placeholder="{{t:template.write.placeholder}}"><astl-prompt>{{t:template.write.question}}</astl-prompt></astl-long-answer>Accessibility
Section titled “Accessibility”- Pattern: multi-line textbox labelled by the prompt and described by its character counter.
- Keys: Tab.
What every element must keep: Accessibility.
CSS parts: long-answer, prompt, input, counter, hint. 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-long-answer>: playful, notebook.
| Template | Parts it restyles |
|---|---|
notebook |
prompt: font-family |
Editor
Section titled “Editor”| Property | Value |
|---|---|
| Label | Long answer (editor.label) |
| Description | The student writes an answer in their own words, and the teacher marks it. (editor.description) |
| Icon | note-pencil |
| Id prefix | answer: new elements get answer-1, answer-2, ... |
Inspector fields, in order:
| Field | Edits | Label | Help |
|---|---|---|---|
attribute |
attribute rows |
Lines in the box | One line makes a single-line answer. |
attribute |
attribute minlength |
Fewest characters | The student sees how many more to write. |
attribute |
attribute maxlength |
Most characters | The box takes no more. Without a number: 2000. |
attribute |
attribute placeholder |
Hint in the empty box |
All messages
Section titled “All messages”Every key of astl.long-answer: ui.* for students (messages/ui/<locale>.json, the only strings the element loads), issue codes, editor.* and template.* for authors (messages/<locale>.json).
21 keys in English and Polish
| Key | Messages |
|---|---|
ui.count |
English: {count} of {max, plural, one {# character} other {# characters}} Polish: {count} z {max, plural, one {# znaku} few {# znaków} many {# znaków} other {# znaku}} |
ui.full |
English: The limit of {max, plural, one {# character} other {# characters}} is reached. Polish: Osiągnięto limit {max, plural, one {# znaku} few {# znaków} many {# znaków} other {# znaku}}. |
ui.more |
English: {count, plural, one {Write at least # more character.} other {Write at least # more characters.}} Polish: {count, plural, one {Napisz jeszcze co najmniej # znak.} few {Napisz jeszcze co najmniej # znaki.} many {Napisz jeszcze co najmniej # znaków.} other {Napisz jeszcze co najmniej # znaku.}} |
LONG_ANSWER_PROMPT_MISSING |
English: Long answer {id} has no question: the box needs one as its label. Polish: Długa odpowiedź {id} nie ma pytania, a pole potrzebuje go jako etykiety. |
LONG_ANSWER_LIMITS |
English: Long answer {id} asks for at least {min} characters but takes at most {max}. Polish: Długa odpowiedź {id} wymaga co najmniej {min} znaków, a przyjmuje najwyżej {max}. |
editor.label |
English: Long answer Polish: Długa odpowiedź |
editor.description |
English: The student writes an answer in their own words, and the teacher marks it. Polish: Uczeń odpowiada własnymi słowami, a ocenia nauczyciel. |
editor.rows |
English: Lines in the box Polish: Wiersze pola |
editor.rowsHelp |
English: One line makes a single-line answer. Polish: Jeden wiersz daje odpowiedź w jednej linii. |
editor.minlength |
English: Fewest characters Polish: Najmniej znaków |
editor.minlengthHelp |
English: The student sees how many more to write. Polish: Uczeń widzi, ile jeszcze ma napisać. |
editor.maxlength |
English: Most characters Polish: Najwięcej znaków |
editor.maxlengthHelp |
English: The box takes no more. Without a number: 2000. Polish: Pole nie przyjmie więcej. Bez liczby: 2000. |
editor.placeholder |
English: Hint in the empty box Polish: Podpowiedź w pustym polu |
editor.template.write |
English: Write your answer Polish: Napisz odpowiedź |
editor.template.write.description |
English: A question answered in a few sentences, read by the teacher Polish: Pytanie, na które uczeń odpowiada kilkoma zdaniami, a czyta je nauczyciel |
template.prompt |
English: Type the question Polish: Wpisz pytanie |
template.write.title |
English: My favourite book Polish: Moja ulubiona książka |
template.write.instruction |
English: Answer in a few full sentences. Your teacher will read your answer. Polish: Odpowiedz kilkoma pełnymi zdaniami. Twoją odpowiedź przeczyta nauczyciel. |
template.write.question |
English: Which book did you enjoy most this year, and why? Polish: Która książka najbardziej Ci się podobała w tym roku i dlaczego? |
template.write.placeholder |
English: The book I enjoyed most was Polish: Najbardziej podobała mi się książka |