# Lamp pool

A warm pool of lamplight on a desk. The desk is the finish’s own, with a fine grain, and a lamp over one corner throws an oval of light that fades to the dim of the room. On a fine pointer the lamp drifts a little toward the pointer, eased. The warmth is the filament lamp’s colour and nothing else: it is not a new colour in the kit.

Kit part · Free · https://tactileui.dev/parts/lamp-pool

- Element: `<div class="tui-backdrop tui-backdrop--lamp-pool" aria-hidden="true">`
- Needs: `kit.css` and `kit.mjs` ([how to install the kit](https://tactileui.dev/docs/installation#the-kit))
- Categories: Lit surfaces
- Finishes: Aluminium, Graphite, Oak, Walnut, Porcelain, Black, Daylight, Night, Paper, Phosphor, E-paper, AMOLED
- Volumes: Tactile, Quiet

## Variants

### Behind a section · the default

```html
<section class="tui-backdrop-host" style="width:min(100%,560px);padding:40px 32px;border-radius:var(--tui-r-l);text-align:left;display:grid;gap:12px;justify-items:start"><div class="tui-backdrop tui-backdrop--lamp-pool" aria-hidden="true"></div><div class="tui-heading"><span class="tui-label">Quay Street studio</span><h2 class="tui-h2">Booked until Friday</h2></div><p class="tui-lead" style="margin:0">Two rooms are free on Saturday morning. Hold one for an hour while you decide.</p><button class="tui-key tui-key--primary" type="button">Hold a room</button></section>
```

### A panel standing on it

```html
<section class="tui-backdrop-host" style="width:min(100%,480px);padding:28px;border-radius:var(--tui-r-l)"><div class="tui-backdrop tui-backdrop--lamp-pool" aria-hidden="true"></div><div class="tui-panel" style="display:grid;gap:12px;text-align:left"><div class="tui-panel__head" style="margin-bottom:0"><span class="tui-label">Berth B1</span><span class="tui-status"><span class="tui-lamp" data-lamp="green" data-on></span>Free</span></div><p class="tui-text" style="margin:0">Free from Saturday morning.</p></div></section>
```

### The lamp fixed · data-still

```html
<section class="tui-backdrop-host" style="width:min(100%,420px);padding:28px 24px;border-radius:var(--tui-r-l);text-align:left;display:grid;gap:12px;justify-items:start"><div class="tui-backdrop tui-backdrop--lamp-pool" data-still aria-hidden="true"></div><div class="tui-heading"><span class="tui-label">Quay Street studio</span><h2 class="tui-h2">Open late</h2></div><p class="tui-lead" style="margin:0">The studio keeps its lamps on until ten.</p><button class="tui-key tui-key--primary" type="button">See the rota</button></section>
```

### The lamp moved · --bd-x and --bd-y

```html
<section class="tui-backdrop-host" style="width:min(100%,420px);padding:28px 24px;border-radius:var(--tui-r-l);text-align:left;display:grid;gap:12px;justify-items:start"><div class="tui-backdrop tui-backdrop--lamp-pool" data-still style="--bd-x: 150px; --bd-y: -60px" aria-hidden="true"></div><div class="tui-heading"><span class="tui-label">Quay Street studio</span><h2 class="tui-h2">Open late</h2></div><p class="tui-lead" style="margin:0">The studio keeps its lamps on until ten.</p><button class="tui-key tui-key--primary" type="button">See the rota</button></section>
```

## Every state

- At rest
- Lamp moved up
- Lamp moved right

Hover, pressed and focus are forced with `.is-hover`, `.is-down` and `.is-focus`; checked and disabled are real.

## API

| Name | Kind | Values | What it does |
| - | - | - | - |
| .tui-backdrop-host | class | on the section | A box that is positioned and makes its own stacking context, so the backdrop stays behind the section’s own content. Any element will do. |
| div.tui-backdrop[aria-hidden="true"] | element | the first child of the host | The surface. It fills the host, follows its rounded corners, and takes no pointer events and no focus. |
| .tui-backdrop--lamp-pool | modifier | the surface | The finish’s desk with a grain, a pool of light over one corner and the dim of the room round it. |
| --bd-lamp | custom property | a colour | The lamp’s colour: the filament lamp’s, as the cloth selector’s. Leave it; a different colour is a different lamp. |
| --bd-x · --bd-y | custom property | lengths | How far the lamp has moved from where it rests. The script sets them as the pointer moves; set them yourself for a fixed place. |
| [data-still] | attribute | on the backdrop | Keeps the lamp where it is, whatever the pointer does. |
| wireBackdrops(root) | function | needs kit.mjs | Wire the backdrops in root, or in the page. kit.mjs already does this for the page and for what is added to it. |

## Markup

```html
<section class="tui-backdrop-host">
  <div class="tui-backdrop tui-backdrop--lamp-pool" aria-hidden="true"></div>
  <div class="tui-heading">
    <span class="tui-label">Quay Street studio</span>
    <h2 class="tui-h2">Booked until Friday</h2>
  </div>
  <p class="tui-lead">Two rooms are free on Saturday morning.</p>
  <button class="tui-key tui-key--primary" type="button">Hold a room</button>
</section>

<!-- data-still keeps the lamp where it is. Put it somewhere else: style="--bd-x: 120px; --bd-y: -40px". -->
```

```js
import { wireBackdrops } from '/kit/kit.mjs';

// kit.mjs wires the backdrops on the page, and any added later.
wireBackdrops(container); // one inside a container you built yourself
```

The demo on the page:

```html
<section class="tui-backdrop-host" style="width:min(100%,720px);padding:40px 32px;border-radius:var(--tui-r-l);text-align:left;display:grid;gap:12px;justify-items:start"><div class="tui-backdrop tui-backdrop--lamp-pool" aria-hidden="true"></div><div class="tui-heading"><span class="tui-label">Quay Street studio</span><h2 class="tui-h2">Booked until Friday</h2></div><p class="tui-lead" style="margin:0">Two rooms are free on Saturday morning. Hold one for an hour while you decide.</p><button class="tui-key tui-key--primary" type="button">Hold a room</button></section>
```

## Usage notes

Move the pointer over the section: the lamp follows, slowly and not all the way. On a touch screen, or with reduced motion on, it stays put.

## Accessibility

- It is decoration: the element is hidden from a screen reader, never takes focus and never takes the pointer.
- The pool is kept dim enough that a heading, a line and a key on top clear 4.5:1 on its brightest and its darkest pixel, in all twelve finishes and both volumes. A pale finish gets a stronger pool than a dark one, because it can bear one.
- The lamp moves only on a fine pointer, only while motion is allowed, and only a little: under half the way to the pointer. On touch and under reduced motion it stays where it rests.
- It stops easing the moment it has arrived, and does not run while the section is off screen or the tab is hidden.
- Warmth is never the only thing that says anything: the section’s words carry the meaning.

## How it’s built

Put `class="tui-backdrop-host"` on the section and the backdrop first inside it. The backdrop sits behind everything else in the host, so the heading, the line and the key need nothing of their own. The desk is the finish’s `--tui-desk` with a tiled grain. The pool is one radial gradient in the filament lamp’s colour, its fall-off baked into the stops, so nothing is blurred. The script moves that layer with `translate`, eased a few percent a frame, only while the pointer is moving it.

## Rules

Put a lamp over a section: a warm pool of light on a grained desk that drifts toward the pointer, gently, and holds still otherwise.

The full rules are in `lamp-pool.rules.md` in the brain, which ships with the Kit.

## Related parts

- [Brushed metal](https://tactileui.dev/parts/brushed-metal): A brushed metal surface under a raking light. The grain runs one way, as if drawn with a wire brush, and a soft sheen crosses it in bands. On a fine pointer the light turns slowly toward the pointer as it crosses the section and settles where you leave off; on touch it rests. Otherwise it is still, so it costs nothing at rest.
- [Louvre light](https://tactileui.dev/parts/louvre-light): A wall lit from the side, with the shadows of slats across it, as when the sun comes through blinds. The wall and its light are fixed; the slat shadows drift sideways across it very slowly and come back. Their edges are soft, drawn into the gradient rather than blurred, and the whole thing holds still when it is off screen.
- [Grille moiré](https://tactileui.dev/parts/grille-moire): Two speaker grilles laid one over the other. Each is a plate drilled with a lattice of round holes; one turns a few degrees and back, and where its holes meet the other’s the dark behind shows through. Those dark spots gather and thin and drift across the surface, the way two real grilles beat against each other. Slow, and held still off screen.
- [Lamp](https://tactileui.dev/parts/lamp): The only colour in the kit: a lamp that is on. Green is on, amber is waiting, red is recording or failing, blue is linked, white is standing by. Always next to words.
