Skip to the page
TACTILE UI

06.4Block 06.4 · Bento grids

Specimen Case

A bento of glass-topped compartments in a machined case, each holding one real Tactile object running small (the Odometer, the Flip-Dot, the Detent Dial, the Vessel) with an engraved label card under the glass. Light comes from above: hover, focus or press Light and that case wakes; the others sleep.

Version
0.1.0
Size
99.5 KB gzipped
Access
With a Pass
Needs
specimen-case.mjs + specimen-case.css · Odometer, Flip-Dot, Detent Dial, Vessel
Tests
18 tests · 11 states
On this page
  1. Use it
  2. Options
  3. Methods
  4. States
  5. How it works
  6. Built with
01

Use it

A features section that shows a product's parts as specimens. The four objects are the library's own, mounted and run in their cases, not drawn to look like them; each sits behind glass with a card that says what it does for the product. A case is lit while the pointer is over it, focus is in it or its Light key is pressed (a tap on the glass pins it on for touch), and only a lit case does anything: the counter turns, the sign flips its message, the dial sweeps between notches, the liquid finds a new level. Off screen, in a hidden tab and under reduced motion nothing runs at all, so a page of dark cases costs nothing.

Copy the specimen-case folder and the odometer, flip-dot, detent-dial and vessel 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="odometer/odometer.css">
<link rel="stylesheet" href="flip-dot/flip-dot.css">
<link rel="stylesheet" href="detent-dial/detent-dial.css">
<link rel="stylesheet" href="vessel/vessel.css">
<link rel="stylesheet" href="specimen-case/specimen-case.css">
<div id="specimen-case"></div>

<script type="module">
  import Odometer from './odometer/odometer.mjs';
  import FlipDot from './flip-dot/flip-dot.mjs';
  import DetentDial from './detent-dial/detent-dial.mjs';
  import Vessel from './vessel/vessel.mjs';
  import { mount } from './specimen-case/specimen-case.mjs';

  const specimenCase = mount(document.getElementById('specimen-case'), {
    label: 'Specimens',
    title: 'Every part on the bench is real.',
    lead: 'Four of the parts Lode is built from, each in its own case. Light one from above and it wakes.',
  }, { Odometer, FlipDot, DetentDial, Vessel });

  // specimenCase.update({ … });   change any option in place
  // specimenCase.destroy();        and take it away again
</script>
02

Options

OptionTypeDefaultWhat it does
labeltext'Specimens'Label
titletext'Every part on the bench is real.'Headline
leadtext'Four of the parts Lode is built from, each in its own case. Light one from above and it wakes.'Lead
countnumber, 3 to 44Three (the Odometer, the Flip-Dot and the Detent Dial) or four (with the Vessel). Each is a real object, run in its case.
livebooleantrueOn: a lit case wakes its object (the counter turns, the sign flips, the dial sweeps, the liquid moves). Off: the objects stay still and can only be handled.
finishauto · aluminium · graphite'auto'Auto follows the page’s data-finish, then the visitor’s system. The objects follow it too.
03

Methods

mount(element, options, { Odometer, FlipDot, DetentDial, Vessel })
Builds the block inside the element and returns its handle. Hand it the Odometer, Flip-Dot, Detent Dial and Vessel it is built with.
handle.objects
handle.lit
handle.light(id, on = true)
handle.update(next = {})
Change options in place.
handle.destroy()
Stops it and cleans up after it.
04

States

  1. At restFour compartments in a machined case, a bento of two wide and two tall: each object at rest behind dimmed glass, its lamp dark, its card of text beneath. Nothing moves.
  2. LitHover a compartment, focus into it, or press its Light key: the lens in its lid lights amber, a cone of light falls on the glass and the dim lifts over 320 ms. The count in the case's band says how many are lit. specimen-light fires.
  3. RunningOnly a lit case runs: the Odometer counts runs at 2.4 a second, the Flip-Dot changes its message every 3 s in a wave, the Detent Dial sweeps between notches every 1.7 s (a hand on it stops the sweep), the Vessel finds a new level every 3.2 s. Unlit, each stops and the object holds still.
  4. HandledThe objects are real: turn the dial, tap the glass of the Vessel, drag the Flip-Dot. The dial is a slider with its own keyboard.
  5. TouchA finger on the glass lights the case and leaves it lit; the Light key turns it off. The key is 28px tall in a 34px lid.
  6. KeyboardEach Light key is a button with aria-pressed named for its case; focus anywhere in a case lights it, and the Detent Dial takes the arrow keys.
  7. Idle and off screenNo timer runs unless a case is lit, the block is on screen and the tab is visible; each stops when any of those stops holding.
  8. TabletTwo columns: the Odometer and the Flip-Dot each across the width, then the dial and the vessel side by side.
  9. PhoneOne column in reading order at 390px; the objects re-fit their glass; no sideways scroll.
  10. Reduced motionNothing runs by itself: lighting a case only changes the light, without a fade, and the objects can still be handled.
  11. FinishesAluminium and graphite by data-finish; the objects follow (bone drums and steel, or ink drums and graphite; an aluminium or graphite dial; white discs; mercury).
05

How it works

Made of: Real objects in deps, Lit only runs, Container query bento, Lamp cone and dim, Light key aria pressed, Touch pins light, One timer per lit case, Sleep off screen and hidden, Reduced motion static, Object finish mapping, Finish following.

Read more: How the Odometer carries · Odometer, odometer.js, NumberFlow.

Original composition on the Odometer (06.4: the counter is the object the case is numbered under; the block runs four objects and lists them all): Lode and its copy are invented. The Odometer, the Flip-Dot, the Detent Dial and the Vessel arrive in deps and are never imported by the block; each is constructed in its compartment and dressed by the finish. The case, the wells, the lamps, the keys, the glass and the cards are CSS drawn in the kit's tokens; no image. Faces: Instrument Sans and Geist Mono (SIL OFL 1.1); the Odometer keeps its own.

06

Built with

More blocks on the same object:

Docs
Finish
Volume