# Aperture bento

> A four-cell bento for infrastructure products: a traffic chart you can sweep, a region map you can click, a config diff you can apply and a deploy trace you can drag.

Most bento grids are static rounded tiles with stock icons and decorative border glows. Aperture bento seats four living product machines inside one hairline-divided frame, all driven by a shared workload preset switcher. The lit hero cell draws 48 upright hairline-mark columns in Canvas 2D with a spring optical lens and cooling brightness trails; the routing mesh lets visitors click any regional hub to reroute live packet arcs and roll p95 latency; the policy gate applies or reverts real config diffs in place; and the build-to-edge timeline scrubs smoothly under a draggable spring playhead.

## Install

```bash
npx shadcn@latest add @hairline-pro/aperture-bento
```

Needs React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.

- npm: `lucide-react`
- Hairline UI components it needs (the CLI installs them too): `number-roll`, `text-morph`
- Docs and live preview: https://hairlineui.com/blocks/aperture-bento
- Premium block, included with All-Access (https://hairlineui.com/buy/all-access?from=blocks). Installs only with an All-Access token through the @hairline-pro registry: https://hairlineui.com/ui/installation#premium. Its source isn't public.

## Usage

```tsx
import { ApertureBento } from "@/components/aperture-bento";

<ApertureBento
  eyebrow="Platform architecture"
  heading="Four systems built to stay fast together."
/>
```

## Drop-in feature bento on a product homepage

Pass your own presets, regional hubs, policy lines and pipeline stages to tailor ApertureBento to your product while keeping every interaction wired.

```tsx
import { ApertureBento } from "@/components/aperture-bento";

export function ArchitectureSection() {
  return (
    <section className="mx-auto max-w-[1280px] px-4 py-16">
      <ApertureBento
        eyebrow="Edge runtime"
        heading="Built for global traffic without regional config."
        subheading="Inspect throughput windows, reroute regions, test a policy diff and scrub a full deploy below."
        diffFile="kestrel-policy.toml"
      />
    </section>
  );
}
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `eyebrow` | `string` | `"Platform architecture"` | Plain sentence-case section label above the heading. |
| `heading` | `string` | – | Primary display headline for the bento section. |
| `subheading` | `string` | – | Supporting sentence explaining what visitors can interact with. |
| `presets` | `AperturePreset[]` | – | Workload scenarios shown in the top-right switcher; each supplies a telemetry wave, regional latencies and trace duration. |
| `seriesLabels` | `[string, string, string, string]` | – | Legend labels matching the four shadcn chart series tokens. |
| `regions` | `ApertureRegion[]` | – | Clickable regional hubs rendered on the Canvas 2D routing mesh. |
| `diffFile` | `string` | `"edge-policy.toml"` | Filename shown in the header of the policy diff cell. |
| `diffLines` | `ApertureDiffLine[]` | – | Context, removed and added config lines toggled by the Apply / Revert button. |
| `tracks` | `ApertureTrackStage[]` | – | Parallel pipeline tracks inspected by the draggable spring playhead. |
| `accent` | `string` | `"var(--primary)"` | CSS colour or token tinting the lit hero cell and active routing hub. |

## States

- **preset switch**: Glides the solid grey preset thumb in 360ms, morphs the 48 hairline columns toward the new wave and rolls throughput and regional latency figures.
- **telemetry lens**: Sweeping the pointer across the lit hero canvas steers a spring lens rule, illuminating nearby columns and cooling passed bars cleanly.
- **region reroute**: Selecting any edge hub fires an arrival ring pulse, redirects animated packet arcs toward that hub and rolls p95 latency.
- **policy toggle**: Clicking Apply policy crosses out removed lines, ticks added rules, increments the active rule counter and morphs the button to Revert policy.
- **pipeline scrub**: Dragging the hairline playhead (or using Arrow keys) glides with spring inertia, rubber-bands at both edges and syncs the active stage readout.
- **reduced motion**: Renders crisp finished Canvas 2D frames without continuous loops and switches presets, regions and playhead positions immediately in place.

## What it handles

Building a bento section where every cell is genuinely interactive—custom Canvas 2D graphics, spring-driven scrubbing, live theme token syncing and container-query mobile stacking—normally takes multiple charting and animation libraries.

- **48-column hairline telemetry field**: Draws stacked hairline dashes in Canvas 2D with a spring-driven optical lens, spatial falloff and cooling brightness trails.
- **Interactive edge routing mesh**: Clicking or arrowing to any region hub sends a spring arrival pulse, reroutes curved packet arcs and rolls latency with NumberRoll.
- **Inline atomic policy diff gate**: Applies or reverts threshold diffs in place with TextMorph button feedback and live active rule counts.
- **Draggable spring pipeline scrubber**: Scrubbing the hairline playhead (with rubber-band edges and keyboard slider support) updates stage details and elapsed ms live.
- **Shared workload preset choreography**: Switching presets glides the solid grey tab thumb and updates the telemetry wave, regional latencies and trace duration together.
- **Theme tokens, off-screen sleep and reduced motion**: Re-reads shadcn chart and surface tokens automatically on theme switches, sleeps off screen and freezes animations cleanly under reduced motion.

## Replaces

static bento card grid, charting library for sparklines, animated network diagram, interactive timeline scrubber

## Where it fits

- **Developer infrastructure & cloud platforms**: Shows real-time request distribution, edge routing latency, config diffs and deploy traces in one cohesive section.
- **AI workflow & agent platforms**: Swap in model throughput, regional routing, guardrail policy diffs and multi-step execution traces.
- **Observability & analytics homepages**: Lets visitors sweep across live hairline data windows and scrub trace timelines directly on the marketing page.
- **B2B SaaS feature deep-dives**: Replaces generic icon-grid feature cards with four interactive product stories driven by one preset switcher.

## Notes

- Pure Canvas 2D and spring physics from ui-interaction-motion.ts with zero charting or animation library dependencies.
- Uses container queries (`@container`) inside a `data-natural-width` strut so it adapts cleanly to any column width from 320px phones to wide desktop canvases.
- All interactive controls expose semantic ARIA roles (`tablist`, `radiogroup`, `slider`) with full keyboard support; decorative canvases are marked `aria-hidden`.
- Automatically suspends Canvas 2D animation frames when scrolled off screen (`IntersectionObserver`) or hidden (`visibilitychange`).

License: Hairline UI commercial license, not MIT (https://hairlineui.com/license#blocks)
