← All patterns
Interactive pattern

Code lab

Build a three-line placeholder query across four selection-based rounds: pick a code fragment, see it land in a dark console, review a three-row result table, then advance to a completion strip.

Placeholder interactive — try it Open full page

The brief template

This is the brief template for the interaction above. Copy it, fill in the Content slots with your material, and leave the technical details unless you want the interaction to behave differently.

Interaction name: code-lab

Purpose. Give the learner a way to build a short query step by step by choosing code fragments — seeing each choice land in a console and return a result — without any free typing.

Content — complete each slot with your material. The interaction's built-in labels and prompts stay as they are.

Title: …

Body copy (intro): …

Console query template (the code lines, with one slot per round): …

Round 1 task (one line): …

Round 1 fragment options (one per line, 3 chips): …

Round 1 correct fragment: …

Round 1 result table (3 rows or fewer): …

Round 1 explanation (one line): …

Round 2 task (one line): …

Round 2 fragment options (one per line, 3 chips): …

Round 2 correct fragment: …

Round 2 result table (3 rows or fewer): …

Round 2 explanation (one line): …

(repeat the block for each round)

Completion line (shown when the lab is finished): …

You can place 2–6 rounds using this interaction.

When the content is complete: copy and paste the whole brief into the SB and assign a CU ticket.


Technical details for the LT — don't update unless you want the interaction to behave differently.

Layout. The title with the body copy beneath. A row of progress chips ("Round 1"–"Round N") with a "Round x of N" line beneath. Below that, a dark console-styled panel (the page itself stays light) showing the query template, whose fragment slots start as dotted placeholders. Below the console, one round panel at a time: the round heading, its one-line task, the clickable code-fragment chips, and a result area — the result table, the one-line explanation, and a "Next round" button (the last round's reads "Finish lab") — hidden until a fragment is chosen. After the last round, a completion strip with a tick icon, the completion line, and a "Restart lab" button.

Interaction. Clicking a fragment chip inserts that fragment into its console slot instantly (no typewriter effect) — the filled slot gets a solid plate and bold weight, the chosen chip gets a pressed state with a tick icon (never colour alone) — and reveals that round's result table, explanation, and next button. The learner can change their choice before advancing; the console updates. "Next round" hides the current round, shows the next, marks the finished chip done with a tick, and updates the progress line. "Finish lab" shows the completion strip and marks all chips done. "Restart lab" resets the console slots, chips, and rounds to the start. All controls are native buttons, fully keyboard operable; focus moves to the revealed next button and then to each new round's first chip.

States. Rounds are shown one at a time, round 1 the default, plus a final completed state. Per round, the result area is hidden or revealed, and exactly zero or one of its chips is pressed. Each console slot is unfilled (dotted placeholder) or filled. Progress chips are upcoming, current (thick border and bold), or done (filled with tick).