Blocks to handle: legend, summary, figure, template and a table of buttons

Five ideas from the element catalogue in which the canvas turns a block element into a thing to pick up, pull or press: fieldsets as a stack of folders, a details element worked by a lever, figures as prints on a table, one template cloned into many tickets, and a table of buttons as a minefield. Every part that takes a tap is the element itself.

Folder tabs from legends

Three <fieldset> elements drawn as a stack of folders. The <legend> of each is its tab. Tap a tab: that folder rises out of the stack and comes down in front. The fields of the front folder can be used.

The folders overlap, and where they do the one drawn last takes the input. Drawing them from the back to the front is therefore enough: the fields of a folder behind can't be tapped through the folder in front, and each tab can, because it stands above it.

Show the code
  1. Three drawable fieldsets, each with a button in its legend.
  2. Draw the stack from the back, and move a folder to the front on a tap.
  3. Styles.

Summary as a lever

A <details> element and a lever drawn by the canvas. Drag the red knob to the right: the content unrolls as far as the lever has gone. Let go and it falls to the nearer end. A tap on the summary, or Enter on it, throws the lever.

Tide times for Saturday

High water 04:12 and 16:38.

Low water 10:25 and 22:51.

The slip is dry from 09:00 to 12:00. All elements

A closed <details> is only as tall as its summary, and its content isn't painted, so it can't be drawn half open. The element is opened as soon as the lever leaves its stop, and the canvas draws only a part of its height.

Show the code
  1. An ordinary details element.
  2. The lever sets how much of the content is drawn, and when the element is open.

Template stamped many times

One <template> with a ticket in it, cloned as many times as the slider says. Pick a layout: the tickets move to it one after another. Each ticket is a button that counts its own taps.

A <template> inside a canvas has no box and is never drawn. Its clones are ordinary children, and each has its own picture, its own hit region and its own state.

Show the code
  1. The template. The canvas has no other children in the markup.
  2. Clone it, and draw each clone at its place in the layout.

Minesweeper from a table of buttons

An 8 by 8 <table> with a <button> in every cell and 9 mines. Tap a cell. The cells it opens are opened in a wave that travels out from the tap, and each one is drawn enlarged for a moment as the wave reaches it. The first tap is never a mine.

The table is one picture. A cell is drawn enlarged by clipping a second draw of the table to the box of its <td>. The buttons take the taps themselves: the table is drawn flat, so each button is under the finger.

Show the code
  1. An empty drawable table.
  2. The script fills it with 64 buttons.
  3. Open cells in a wave, and draw each new one enlarged.

How it works

Show the code
  1. Each demo starts when its section comes near the screen.
  2. The paint handler shared by the five canvases.
  3. Place a block, and draw one piece of it.
  4. After a lost context the elements are shown as plain HTML.

Live checks

The checks wait for a tap. Each builds its own small canvas in a corner of the window, and none of them touches the demos above.

Findings

Measured in headless Chromium 157 on 2026-11-21. Not yet run on a phone.