01.2Block 01.2 · 404 & errors
Pin 404
A 404 standing out of a pin board. The visitor wipes it flat by hand; a moment later it climbs back up, because the page is still missing.
- Version
- 0.1.0
- Size
- 64.3 KB gzipped
- Access
- With a Pass
- Needs
- pin-404.mjs + pin-404.css · Pin Screen
- Tests
- 12 tests · 10 states
On this page
Use it
Turn the one page nobody wants to land on into the one they play with for ten seconds before going home: the error is an object, the joke is in its behaviour, and the way out is one obvious button.
Copy the pin-404 folder and the pin-screen folder from its package next to your page, link the stylesheets and mount it on an element. Every option has a default; the lab’s Code tab writes the same example at any settings, and for React, Vue, Svelte or a custom element (Using a framework).
<link rel="stylesheet" href="pin-screen/pin-screen.css">
<link rel="stylesheet" href="pin-404/pin-404.css">
<div id="pin-404"></div>
<script type="module">
import PinScreen from './pin-screen/pin-screen.mjs';
import { mount } from './pin-404/pin-404.mjs';
const pin404 = mount(document.getElementById('pin-404'), {
code: 'Error 404 · Page not found',
title: 'Nothing here but pins.',
wit: 'Wipe the 404 flat if it helps. It comes back: the page is still missing.',
}, { PinScreen });
// pin404.update({ … }); change any option in place
// pin404.destroy(); and take it away again
</script>Options
| Option | Type | Default | What it does |
|---|---|---|---|
| code | text | 'Error 404 · Page not found' | Label |
| title | text | 'Nothing here but pins.' | Headline |
| wit | text | 'Wipe the 404 flat if it helps. It comes back: the page is still missing.' | One line of wit |
| path | text | '/journal/pressed-flowers' | Empty shows the real address the visitor asked for. |
| home | text | 'Take me home' | Button |
| homeHref | text | '/' | Button link |
| report | text | 'Report a broken link' | Second link |
| reportHref | text | '/contact' | Second link, address |
| caption | text | 'Fig. 404: {pins} pins, machined frame, shown 1:1.' | {pins} becomes the pins’ material. |
| palette | paper · slate | 'paper' | Warm paper, or dark slate. |
| finish | steel · chalk · brass · ink | 'steel' | Pins |
| light | number, 0 to 345 | 315 | The pins’ lamp; the board’s shadow on the page follows it. |
| heal | number, 0.3 to 1 | 0.85 | How slowly the wiped number rises again. |
Methods
mount(element, options, { PinScreen })- Builds the block inside the element and returns its handle. Hand it the Pin Screen it is built with.
handle.update(next = {})- Change options in place.
handle.boardhandle.roothandle.destroy()- Stops it and cleans up after it.
States
- Arriving404 rises out of the pins in a left-to-right wave; the label, headline, wit and actions rise in behind it.
- At restThe number stands in the board; the board sleeps; its shadow on the page falls away from its lamp.
- WipingThe visitor's hand presses the standing pins back toward flush in a 90px disc.
- Coming backPressure halves every 2.7 s (heal 0.85): the number climbs back on its own and the board sleeps again.
- Hover and focusThe button fills with the accent, the second link turns to it; both show a 2px focus ring.
- PaletteWarm paper or dark slate, each with any pin finish; the caption names the material on screen.
- TabletOne column under 900px with the board first, centred.
- PhoneUnder 560px the board goes 5:4 with finer pins, the actions stack full width.
- Reduced motionThe 404 is standing on the first paint and the pins ignore the pointer; every word is there.
- Off screenThe board's loop pauses; the block runs nothing of its own.
How it works
Made of: Wipe and heal, Object on the page, Lamp true drop shadow, Requested path fallback, Container query recomposition, Palette tokens from one table.
Read more: How the Pin Screen works.
Original composition and copy. The only imagery is the Pin Screen drawing the number in canvas, and two CSS shadows. Faces: Big Shoulders and DM Mono (SIL OFL 1.1) as WOFF2, licences beside them.
Built with
More blocks on the same object: