# Split-flap hero

> A hero built as a split-flap departure board: the headline flips into place letter by letter, visitors can type their own line onto it, and the rows below flip as data changes.

Split-flap hero builds the entire first screen out of one physical medium: a Solari and Vestaboard-inspired mechanical split-flap cabinet. All 48 oversized headline drums and 60 departure-row drums render as 3D split-flap modules with top and bottom lit half-leaves, a 1.5px horizontal axle seam, machined spindle pins and Web Animations API 3D hinged leaf folds across a 44-character drum wheel. The headline clatters in on load, switching board programs re-Flips the full matrix, hovering any departure corridor riffles its flaps left to right, clicking a corridor promotes its telemetry to the giant headline drums, and typing in the inline board composer flips custom words live.

## Install

```bash
npx shadcn@latest add @hairline-pro/flap-hero
```

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): `text-morph`, `number-roll`
- Docs and live preview: https://hairlineui.com/blocks/flap-hero
- 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 { FlapHero } from "@/components/flap-hero";

<FlapHero
  brand="Relay"
  editorialLead="Global edge release & rollback board"
  subheadline="Push once from Git. Every commit replicates across 42 anycast PoPs with automatic health gates."
  primaryAction={{ label: "Start deploying", href: "/signup" }}
  command="npx relay ship"
/>
```

## Full-cabinet departure board hero at the top of a product homepage

Place FlapHero at the top of your landing page. Use `tone="carbon"` for an anodized black cabinet with warm signal-yellow drums, or `tone="ivory"` for a warm architectural ivory cabinet with signal-orange drums.

```tsx
import { FlapHero } from "@/components/flap-hero";

export function HomeHero() {
  return (
    <div className="mx-auto max-w-[1360px] p-3 sm:p-4">
      <FlapHero
        brand="Relay"
        monogram="RL"
        tone="carbon"
        editorialLead="Global edge release & rollback board"
        subheadline="Push once from Git. Every commit replicates across 42 anycast PoPs with automatic health gates and zero maintenance windows."
        primaryAction={{ label: "Start deploying", href: "/start" }}
        command="npx relay ship"
      />
    </div>
  );
}
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `brand` | `string` | – | Brand wordmark displayed in the top-left cabinet header. |
| `monogram` | `string` | – | Two-character code rendered in the top-left mechanical flap badge (defaults to first 2 letters of brand). |
| `navLinks` | `{ label: string; href: string }[]` | – | Navigation links inside the top header with a gliding neutral highlight. |
| `navSecondaryAction` | `{ label: string; href?: string; onClick?: () => void }` | – | Optional subtle right-hand header link (e.g. "Sign in"). |
| `navPrimaryAction` | `{ label: string; href?: string; onClick?: () => void }` | – | Primary top-right signal button with dual-layer vertical text roll. |
| `editorialLead` | `string` | – | Plain human-readable lead label in the program control bar above the split-flap matrix. |
| `subheadline` | `string` | – | Fallback supporting paragraph if a mode omits its own caption. |
| `primaryAction` | `{ label: string; href?: string; onClick?: () => void }` | – | Primary signal-yellow or signal-orange hardware CTA button. |
| `command` | `string` | – | Optional CLI command rendered beside the primary CTA with click-to-copy TextMorph feedback and board riffle. |
| `secondaryAction` | `{ label: string; href?: string; onClick?: () => void }` | – | Optional secondary button rendered when command is omitted. |
| `modes` | `FlapHeroMode[]` | – | Three programmable board modes controlling the 3x16 headline drums, rolling counter and 5-row departure table. |
| `tone` | `"carbon" \| "ivory"` | `"carbon"` | "carbon" renders an anodized black cabinet with signal-yellow drums; "ivory" renders a warm sand cabinet with charcoal and signal-orange drums. |

## States

- **arrival cascade**: On mount, all 48 headline drums and 60 schedule drums clatter through staggered diagonal character wheel steps into their resting message.
- **program switch**: Selecting any of the 3 top program tabs glides the active thumb, rolls the summary counter with NumberRoll and re-flips every headline and schedule drum.
- **row hover riffle**: Moving the pointer onto any departure row triggers a left-to-right mechanical riffle wave across its corridor, latency and status flap cells.
- **corridor promote**: Clicking any departure row highlights it in place and clatters the giant 3-row headline matrix to display that corridor’s live build and latency.
- **live typing**: Typing into the inline board input immediately clatters the giant 3D headline drums to spell the visitor’s custom words, with a one-click Reset.
- **reduced motion**: Suppresses 3D leaf folding and intermediate wheel steps so all character changes and program switches update cleanly in place.

## What it handles

Most split-flap effects on the web are flat monospace boxes that only animate a single counter and collapse on narrow screens.

- **44-character mechanical drum wheel**: Each flap cell steps through deterministic intermediate characters on a physical wheel with WAAPI 3D rotateX leaf folds and zero React re-renders per tick.
- **Machined Solari cell geometry**: Every module renders separate top and bottom half-leaf gradients, a 1.5px equator gap, left and right axle spindle notches and signal-colour drums.
- **3x16 oversized headline matrix**: Forty-eight responsive display drums scale cleanly from 1440px desktop down to 390px phone screens without horizontal overflow.
- **Live type-to-flip board composer**: Visitors can type custom text directly into the recessed well and watch the giant 3-row split-flap matrix clatter live to their message.
- **Interactive 5-row departure schedule**: Hovering any corridor row riffles its origin, destination, metric and status flaps left-to-right; clicking promotes that corridor to the big headline drums.
- **A dark and a light cabinet**: tone="carbon" is a near-black cabinet with yellow drums; tone="ivory" is a light cabinet with charcoal and orange drums.

## Replaces

custom 3D split-flap drum engine, hero navigation header + mobile drawer, interactive live board text composer, 5-row mechanical departure table

## Where it fits

- **Developer infrastructure & deploy platforms**: Displays live global edge cutovers, regional latency corridors and instant rollback telemetry on a mechanical board.
- **Fintech, FX desks & payment rails**: Use tone="ivory" for a light cabinet with charcoal and orange drums for currency settlement times.
- **Logistics, aviation & fleet networks**: Present real-time origin-to-destination corridors with tactile split-flap status cartridges.
- **High-impact product launches**: Visitors can type directly into the board composer and watch the 48 oversized headline drums clatter to their words.

## Notes

- Zero WebGL or external animation library required: each flap cell drives its own Web Animations API 3D rotateX leaf fold and direct DOM text updates for 60fps performance.
- The visual split-flap grid is paired with a screen-reader `<h1>` and full keyboard navigation (`role="tablist"` with Left/Right arrow keys, native button rows and labeled custom input).
- Honors `prefers-reduced-motion: reduce` by updating characters immediately in place without intermediate wheel clatter.

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