UICraft / Craft
CSSDepartures Board

How Departures Board works

An airport departures board drawn from 5×7 LED tiles. Flights board, leave, and shuffle in as the clock runs.

Demo
Departures
TimeDestinationFlightGateRemarks

How it works

The whole board grows from one small piece: a tile of 35 lights. Make that tile look like 0, and you know how to make A, :, and every other character too. Thanks to @kayanoesasaki's post for the idea behind this board.

Make one bitmap letter5 × 7 lights
Start withChoose a shape, then edit its lights.

01 / Draw with switches

R4 · C3
12345
1
2
3
4
5
6
7
1 = on 0 = off

The same 35 switches, now shown as round LEDs.

02 / Save the drawing

35 BITS
RowPatternIndex
1011100–4
2100015–9
31001110–14
41010115–19
51100120–24
61000125–29
70111030–34

Read each row left to right, then move down.

Complete 35-character string01110100011001110101110011000101110

03 / Find one light

string[17] = 1row 4, col 3

17 ÷ 5 = 3 complete rows with 2 left over. This LED is on.

01 — Draw one tiny picture

Look at Draw with switches above. It is graph paper with five squares across and seven down. Each square is a little light switch. Tap a square to turn it on or off. Try turning off the middle square in row 4, then turn it on again. The picture changes immediately.

Each square is an HTML button, so it can be clicked or used with a keyboard. The CSS grid has five switch columns and a narrow space for row numbers. React's useState remembers which lights are on after a tap. The onClick handler replaces just that square's value.

01-change-one-light.tsx
const [glyph, setGlyph] = useState(FONT["0"])
 
// dot is the square you tapped, numbered 0 through 34.
setGlyph((current) =>
  current.slice(0, dot) +
  (current[dot] === "1" ? "0" : "1") +
  current.slice(dot + 1)
)

You made: one editable 5×7 character tile. The buttons are square so you can see its little drawing grid.

02 — Write down the picture

Look at Save the drawing. For every row, write 1 for an on square and 0 for an off square. The number 0 starts like this:

row 1   01110   ·●●●·
row 2   10001   ●···●
row 3   10011   ●··●●
row 4   10101   ●·●·●
row 5   11001   ●●··●
row 6   10001   ●···●
row 7   01110   ·●●●·

There are seven rows of five, so there are 35 digits. Put the rows together, top to bottom, and you have one long string. The FONT object saves a string like this under each character's name. Pick A, :, or Blank above: the same 35 lights stay in place, but their on/off recipe changes. Blank has 35 zeros.

02-save-the-picture.tsx
const FONT: Record<string, string> = {
  "0": "01110100011001110101110011000101110",
  A: "01110100011000111111100011000110001",
  ":": "00000001000010000000001000010000000",
  " ": "00000000000000000000000000000000000",
}

You made: a tiny picture you can save as text. Try drawing your own letter; the 35-digit string changes with every tap.

03 — Read the recipe to light a dot

Look at the position numbers beside Save the drawing. The string is not cut into pieces. The code reads its characters one after another, starting at position 0, and makes one round LED for each character. The LED grid has five columns. Positions 0 to 4 fill its first row; position 5 starts the next row.

             column 1  2  3  4  5
row 1   string index  0  1  2  3  4
row 2                 5  6  7  8  9
row 3                10 11 12 13 14
row 4                15 16 17 18 19
row 5                20 21 22 23 24
row 6                25 26 27 28 29
row 7                30 31 32 33 34

Find 17 in that grid: it is in row 4, column 3. For our 0 drawing, positions 15 to 19 contain 10101, so position 17 contains 1. The round LED there lights up. If you tap that square above, its digit becomes 0 and that one LED goes dark.

How can the code find a position from a row and column? It counts the five digits in every complete row before this one, then moves across. The labels on the drawing start at 1; code coordinates start at 0. So row 4, column 3 becomes y = 3, x = 2: 3 × 5 + 2 = 17.

03-read-one-light.tsx
function lit(glyph: string, x: number, y: number) {
  return glyph[y * 5 + x] === "1"
}

The component draws one SVG for the tile. viewBox makes the picture 5 units wide and 7 units tall, one unit per light. Each digit becomes a <circle> in string order. dot % 5 is the column and Math.floor(dot / 5) is the row. Adding 0.5 puts that circle in the middle of its unit square. lit reads the matching digit and chooses a bright or dark fill.

03-draw-the-leds.tsx
<svg viewBox={`0 0 ${CELL_W} ${CELL_H}`} className="block w-full">
  {Array.from({ length: CELL_W * CELL_H }, (_, dot) => {
    const x = dot % CELL_W
    const y = Math.floor(dot / CELL_W)
    return (
      <circle
        key={dot}
        cx={x + 0.5}
        cy={y + 0.5}
        r={0.38}
        className={lit(glyph, x, y) ? "fill-[#f2f2f2]" : "fill-[#434343]"}
      />
    )
  })}
</svg>

You made: a renderer for any 5×7 bitmap letter. Every digit in the string has one fixed place in the grid and controls exactly one round LED.

04 — Use the tile again and again

Repeat the tileWorld clock board

19:45 New York City. 08:45 Tokyo. 05:15 New Delhi.

The board asks FONT for each character's 35-digit recipe and draws another tile. Five tiles make HH:MM; 12 more make the destination, and so on across the row. A space has an all-zero recipe, so unused tiles stay dark, and the blank tile between columns is just a space too.

The live board briefly swaps characters when a flight's status changes or a new flight arrives, then settles on the new ones; the bitmap rule never changes. Its timers stop when the component leaves the page, and reduced-motion settings show the final characters right away. Screen readers get the flights as a plain table instead of trying to read the dot picture.

Check yourself: If you change one 1 to 0 in a letter's recipe, how many LEDs change? Just one.