← Years 5–6 Creating Digital Solutions

Interface elements: text boxes and labels

A text box lets the user type in an answer. A label is words on the screen that tell the user what to type (prompt text) or show the result (output text).

Understanding Interface elements: text boxes and labels in Years 5–6 Creating Digital Solutions

What it does: This label joins words with the answer. It shows the result to the user as output text. Good prompt text says clearly what the user should enter. 'Box 1' tells the user nothing. Labels can show results. The user does not type into a label. They just read it. Labels only display words. A text box is the element that accepts typing.

Common mistakes: The words that tell the user what to enter are prompt text, so they belong in a label. A text box is where the user types. It should be: label: "Enter your name". numBox is the text box itself. To use what the user typed you need numBox.text. It should be: out.text = numBox.text * 2.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 31–40) and word search (Modules 21–40).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which interface element lets the user type in their name?
A labelA text box
Matches
Textbox: "Type your age here" (used to show the final score)
↓
A text box is for the user to type in. Showing a result needs a label with output text.
Applying
Meanings
Term
text box and label
Meaning
A text box lets the user type in an answer. A label is words on the screen that tell the user what to type (prompt text) or show the result (output text).
Practice
<label for="name">Type your name:</label>
Testing
Gaps
"Type your name:"
Check Answer
Spots
1textbox: "Enter your name"
2textbox: nameBox

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Hyena' badge — Savannah Debugger, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which interface element lets the user type in their name?
A. A text box ✓
B. A label
A text box is where the user types input. A label only shows words on the screen.
2. A label next to a text box says "Type your age:". What is the label's job?
A. It stores the age the user types
B. It tells the user what to type (prompt text) ✓
A label is a prompt. It tells the user what to enter. The text box is where the answer is typed.
3. Which is the best label for a text box that collects a favourite colour?
A. Type your favourite colour: ✓
B. Box 1
Good prompt text says clearly what the user should enter. 'Box 1' tells the user nothing.
4. A quiz app shows "Well done, Mia!" after the user answers. What is this?
A. A text box collecting input
B. A label showing the result as output text ✓
Labels can show results. The user does not type into a label. They just read it.
5. True or false: The user can type their own words into a label.
A. False. They type into a text box. ✓
B. True. Labels are for typing.
Labels only display words. A text box is the element that accepts typing.

Match the Pairs

Label: "Enter your name:" → A label that shows prompt text telling the user what to type
Textbox: nameBox → A text box where the user can type in their answer
A label can show the result as output text after the program has worked it out → Label: "Your total is " + total
A label next to a text box tells the user what to type, so they know what the box is for → Label: "Favourite animal:" | Textbox: animalBox
Textbox: "Type your age here" (used to show the final score) → A text box is for the user to type in. Showing a result needs a label with output text.
Textbox: ageBox (no label beside it) → The text box has no label, so the user does not know what to type. It needs a prompt label such as "Enter your age:".

Key Term

text box and label
A text box lets the user type in an answer. A label is words on the screen that tell the user what to type (prompt text) or show the result (output text).

Fill in the Blanks

1. LABEL "Type your name:" TEXTBOX name
Hint: Type the element keyword that shows prompt words telling the user what to enter.
2. LABEL "Type your name:" TEXTBOX name
Hint: Type the element keyword that lets the user type in an answer.
3. LABEL "Type your age:" TEXTBOX age
Hint: Type the variable name that will store what the user types, matching the prompt.
4. LABEL "Pick a number:" TEXTBOX number LABEL "You typed " + number
Hint: Type the variable holding the user's typed answer so the output label can show it.
5. LABEL "Enter your name:" TEXTBOX name LABEL "Hello, " + name
Hint: Type the symbol that joins the greeting words to the typed name in the output label.

Spot the Error

Question 1
A textbox: "Enter your name"
B textbox: nameBox
C button: "Say hello"
Line A — The words that tell the user what to enter are prompt text, so they belong in a label. A text box is where the user types. It should be: label: "Enter your name".
Question 2
A label: "Pick a number"
B textbox: numBox
C out.text = numBox * 2
Line C — numBox is the text box itself. To use what the user typed you need numBox.text. It should be: out.text = numBox.text * 2.
Question 3
A label: "Your name?"
B textbox: name
C out.text = "Hi " + "name.text"
Line C — Quote marks make name.text plain words, so the label would show name.text instead of the typed name. Remove the quotes: out.text = "Hi " + name.text.
Question 4
A label: "Type your city"
B textbox: cityBox
C button: "Show"
D cityBox.text = out.text
Line D — The result must be shown in the output label, so the label's text gets the value. The line is backwards. It should be: out.text = cityBox.text.
Question 5
A label: "Enter a number"
B label: numBox
C button: "Add 5"
D out.text = numBox.text + 5
Line B — A label only shows words. It cannot be typed into. The user needs a text box to type a number. It should be: textbox: numBox.

Student with a class code? Join your class →