# Patch bay

> An integrations section built as a patch bay: your apps hang on real patch cables, visitors drag a jack into your product’s open port, and light runs along the cable as its data starts counting.

Integrations sections are usually a grid of logos, which says the apps exist and nothing about what connecting one is like. Patch bay makes it physical. Your apps run down one side of a panel, each with a socket and a cable; your product is a dark module with input ports. The cables are WebGL rope: they hang in clean curves, lean on the panel and cast soft shadows on it. Visitors drag any jack into an open port and it clicks in, the port names the app, light runs along the cable and the port counts what the app sends. Pull a jack out to unplug it, or drop it into a full port to swap. A moment after the section comes into view, one cable plugs itself in, so the idea reads before anyone touches it.

## Install

```bash
npx shadcn@latest add @hairline-pro/patch-bay
```

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): none
- Docs and live preview: https://hairlineui.com/blocks/patch-bay
- 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 { PatchBay } from "@/components/patch-bay";

<PatchBay
  headline="Plug in the tools your team already answers from."
  subheadline="Relay pulls every email, thread and contact into one inbox the moment you connect it."
  product={{ name: "Relay" }}
  apps={[
    { id: "gmail", name: "Gmail", sends: "emails", rate: 3.4, start: 18240 },
    { id: "slack", name: "Slack", sends: "threads", rate: 1.2, start: 6312 },
    { id: "hubspot", name: "HubSpot", sends: "contacts", rate: 0.6 },
    { id: "linear", name: "Linear", sends: "issues", rate: 0.4 },
  ]}
  ports={4}
  connected={["gmail", "slack"]}
  autoPlug="hubspot"
/>
```

## Night tone, your face, your cables

PatchBay reads type from --pb-display and --pb-sans and every colour from --pb-* variables. Give an app a cable colour, or set --pb-cable-1 to --pb-cable-8 for the whole set.

```tsx
import { Albert_Sans } from "next/font/google";
import { PatchBay } from "@/components/patch-bay";

const face = Albert_Sans({ subsets: ["latin"], weight: ["400", "600"] });

export default function Integrations() {
  return (
    <PatchBay
      tone="night"
      style={{
        "--pb-display": face.style.fontFamily,
        "--pb-sans": face.style.fontFamily,
        "--pb-live": "#ffd23f",
        "--pb-cable-1": "#ff4d2e",
      } as React.CSSProperties}
      headline="Every answer, from the tools you already use."
      subheadline="Quorum reads your docs, threads and tickets as they change."
      product={{ name: "Quorum" }}
      apps={[
        { id: "notion", name: "Notion", sends: "pages", rate: 0.9 },
        { id: "slack", name: "Slack", sends: "threads", rate: 2.2, cable: "#f4b400" },
      ]}
      connected={["notion"]}
      onConnect={(id, port) => track("plugged", { id, port })}
    />
  );
}
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `eyebrow` | `string` | `"Integrations"` | One plain line above the headline. |
| `headline / subheadline` | `string` | – | The section head: statement left, sentence right. |
| `product` | `{ name: string; logo?: ReactNode }` | – | Your product, named on the module. |
| `apps` | `PatchBayApp[]` | – | { id, name, logo?, sends, rate, start?, cable? }. sends is plural ("messages"); rate is about how many a second. |
| `ports` | `number` | `4` | Input ports on your product. |
| `connected` | `string[]` | – | App ids plugged in at the start, in port order. |
| `autoPlug` | `string` | – | An app that plugs itself into the first open port when the bay is first seen. |
| `onConnect / onDisconnect` | `(appId, port?) => void` | – | Called when a visitor plugs or unplugs a cable. |
| `footnote` | `{ label: string; href: string }` | – | A link under the bay, like “Request an integration”. |
| `tone` | `"studio" \| "night"` | `"studio"` | A light aluminium bay or a black one. |

## States

- **resting**: Plugged cables hang in curves between the apps and the module with light running along them; unplugged jacks rest in their holsters.
- **auto plug**: A moment after the bay comes into view, the autoPlug app lifts its jack and plugs it into the first open port.
- **held**: A held jack lifts off the panel, its shadow spreads, its cable pays out, and the nearest port is ringed.
- **plugged**: The jack seats with a small settle, the socket rings once, and the port names the app and starts counting.
- **swap**: Dropping a jack into a full port sends the cable that was there back to its holster.
- **phone**: Under 820px the apps sit in two columns above the module and the cables hang down into its ports.
- **reduced motion**: No auto plug and no running counts; dragging still works.

## What it handles

Showing integrations usually means a wall of logos, or animated beams that run whether anyone looks or not. A tactile version needs rope physics, shadows and drag and drop that work on phones.

- **Rope that behaves**: 24 Verlet points per cable. Each cable reels to about 1.2× the distance between its ends, so it always hangs in a clean curve and never piles up.
- **Plug, unplug, swap**: Drop a jack within reach of a port and it seats with a small settle. Pull one out to unplug it; drop it into a full port and the old cable goes back to its holster.
- **Live on the port**: Connected ports name the app and count what it sends at the rate you give it. Light runs along the cable at a speed that follows the same rate.
- **Shadows on the panel**: Every cable casts a soft shadow that tightens where it touches the panel and spreads as it rises, so held jacks visibly lift off the bay.
- **Your sockets, your layout**: The bay is HTML: names, logos and ports lay out with CSS, and the cables find their sockets wherever they end up, on desktops and phones.
- **Keyboard and screen readers**: Every app name is a button that plugs it in or out, and the module announces how many inputs are in use.

## Replaces

logo grid, animated beam diagram, rope physics library, drag and drop wiring

## Where it fits

- **Integrations sections**: Replaces the logo grid with something a visitor can do: plug an app in and watch it start sending.
- **AI products that read your tools**: Sources plug into the model: docs, threads and tickets, each counting as it syncs.
- **Data pipelines and ETL**: Connectors as cables into a warehouse, with rows per second on every port.
- **Support and CRM inboxes**: Email, chat and CRM in one place, the way the product actually works.

## Notes

- Colours: --pb-ground, --pb-panel, --pb-panel-edge, --pb-module, --pb-module-ink, --pb-module-ink-2, --pb-ink, --pb-ink-2, --pb-ink-3, --pb-hole, --pb-nut, --pb-metal, --pb-hover, --pb-live, and --pb-cable-1 to --pb-cable-8. They never inherit your shadcn theme.
- The cables run only while something moves, the bay is on screen and the tab is visible; settled cables draw nothing. Counts update ten times a second straight into the readouts, without React renders.
- Needs WebGL2. Without it the bay still lays out and the app buttons still plug things in; only the cables are missing.
- On phones the bay scrolls normally; a touch that starts on a jack drags it.
- Under prefers-reduced-motion nothing plugs itself in and the counts hold still.

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