# Deck hero

> A hero for design studios and agencies, drawn as their design canvas: rulers, layout columns and the work as artboards a collaborator selects one by one.

Studio heroes usually fan a few screenshots behind a pill navbar, the same page every agency has. Deck hero draws the place the work is made. Rulers run along the top and left of the section and read its real pixels; the layout grid’s twelve columns sit faintly behind the nav and the copy, which are placed on them. The headline’s key words are a selected text layer, with handles and a Text tag. Under the copy the studio’s work pans slowly across the canvas as artboards with frame labels. A collaborator’s cursor moves to the next artboard and the selection follows it, with its size tag; the top ruler marks the selection’s width and the frame label turns from the project type to its result. Pointing at an artboard selects it and holds the pan; on phones the deck becomes a swipeable row and the selection follows the card you land on.

## Install

```bash
npx shadcn@latest add @hairline/deck-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): none
- Docs and live preview: https://hairlineui.com/blocks/deck-hero
- Registry item (source): https://hairlineui.com/r/deck-hero.json

## Usage

```tsx
import { DeckHero } from "@/components/deck-hero";

<DeckHero
  brand="Fieldwork"
  headline={["Websites that", "sell the product"]}
  highlight="sell"
  subheadline="Fieldwork designs and builds launch sites for software companies."
  primaryAction={{ label: "Start a project", href: "/contact" }}
  projects={[
    { name: "Keel", kind: "Business banking", year: "2026", result: "+31% account opens", image: "/work/keel.webp", href: "/work/keel" },
    { name: "Earshot", kind: "AI receptionist", year: "2026", result: "2.4× demo bookings", image: "/work/earshot.webp", href: "/work/earshot" },
    { name: "Mordant", kind: "Apparel", year: "2025", result: "+18% add to cart", image: "/work/mordant.webp", href: "/work/mordant" },
  ]}
/>
```

## With your own display face

The hero reads its headline and nav face from --dh-display. Load one with next/font and pass it in; any colour can be overridden the same way.

```tsx
import { Bricolage_Grotesque } from "next/font/google";
import { DeckHero } from "@/components/deck-hero";
import { projects } from "@/content/work";

const display = Bricolage_Grotesque({ subsets: ["latin"], axes: ["opsz", "wdth"] });

export default function Page() {
  return (
    <DeckHero
      className="min-h-dvh"
      style={{
        "--dh-display": display.style.fontFamily,
        "--dh-display-axes": "'opsz' 96, 'wdth' 92",
        "--dh-accent": "#ff4d8d",
      } as React.CSSProperties}
      tone="dark"
      brand="Fieldwork"
      navLinks={[
        { label: "Work", href: "/work" },
        { label: "Services", href: "/services" },
        { label: "Studio", href: "/studio" },
      ]}
      navPrimaryAction={{ label: "Book a call", href: "/call" }}
      eyebrow="Product design studio · Lisbon and remote"
      headline={["Websites that", "sell the product"]}
      highlight="sell"
      subheadline="Fieldwork designs and builds launch sites for software companies. Brief on Monday, live in five weeks."
      primaryAction={{ label: "Start a project", href: "/contact" }}
      secondaryAction={{ label: "See the work", href: "/work" }}
      projects={projects}
      cursorName="Ana"
    />
  );
}
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `brand` | `string` | – | Name in the nav, set in the display face. |
| `logo` | `ReactNode` | – | Mark beside the name. Defaults to a selected square in the accent. |
| `navLinks` | `{ label: string; href: string }[]` | – | Links in the nav; under 900px they fold into a menu set large in the display face. |
| `navSecondaryAction / navPrimaryAction` | `{ label: string; href?: string; onClick?: () => void }` | – | A quiet link and a solid action on the right of the nav. |
| `eyebrow` | `string` | – | One plain line above the headline, e.g. what you do and where. |
| `headline` | `string \| string[]` | – | The headline; an array sets the line breaks. |
| `highlight` | `string` | – | Words inside the headline drawn as a selected text layer. |
| `subheadline` | `string` | – | One sentence beside the headline (under it on narrow screens). |
| `primaryAction / secondaryAction` | `{ label: string; href?: string; onClick?: () => void }` | – | The main action in the accent and a quiet one. |
| `projects` | `DeckHeroProject[]` | – | The work: name, kind, year, result, a 16:10 image, alt and href. Three or more. |
| `cursorName` | `string` | `"Ana"` | Name on the collaborator’s cursor. |
| `frameSize` | `string` | `"1440 × 900"` | Size written under the selection. |
| `tone` | `"dark" \| "light"` | `"dark"` | A dark or light canvas. Every colour is a --dh-* variable you can override. |
| `autoPlay` | `boolean` | `true` | Pan the deck and move the selection on its own. |

## States

- **arrival**: The text layer’s selection draws around the highlighted words at 520ms; the first artboard is already selected and the deck starts panning at 18px a second.
- **select**: About 0.9s in, and every 3.4s after, the cursor glides to the next artboard over 760ms and the selection morphs to it over 460ms. When the next one would be off the right edge it goes back to the first one fully on screen.
- **result**: The selected artboard’s label crossfades from its type and year to its result; the top ruler’s band moves to the selection’s width.
- **point**: Pointing at an artboard selects it over 260ms, hides the cursor and eases the pan to a stop; leaving lets it drift on again.
- **phone**: Under 720px the row scrolls natively with snap points; the selection follows the nearest card and the cursor and left ruler are left out.
- **reduced motion**: No pan and no cursor: the first artboard stays selected and pointing at another moves the selection.

## What it handles

A work showcase in a hero is usually a carousel with arrows and dots, or a fan of tilted cards with soft shadows that crowds the headline and breaks on phones.

- **A canvas, not a backdrop**: Rulers count the section’s real pixels and the twelve layout columns behind the copy are the ones the nav and headline sit on.
- **The work, selected**: A cursor with a name moves to an artboard, the selection box follows with handles and a size tag, and the label shows the result.
- **Yours to point at**: Pointing at an artboard selects it and eases the pan to a stop; every artboard can link to its case study and is reachable by keyboard.
- **Phones get a real row**: Under 720px the deck becomes a native swipe row with snap points, and the selection follows the card you land on.
- **Its own look**: Dark and light canvases ship as --dh-* variables; pass your display face through --dh-display and it sets the headline and nav.
- **Light to run**: One loop moves the row, the selection and the cursor with transforms; it stops off screen and in background tabs.

## Replaces

portfolio carousel, card fan, marquee of screenshots, hero navbar

## Where it fits

- **Design and product studios**: Lead with the work: each shipped site is an artboard with its client, type and result.
- **Web and brand agencies**: The canvas says “we make things” before a word is read, and every card links to its case study.
- **Freelance designers**: Six projects, your name on the cursor and your availability in the line above the headline.
- **Template and theme shops**: Show the range of what you sell as a moving deck of real screens.

## Notes

- The hero has its own palette (--dh-canvas, --dh-ink, --dh-rule, --dh-ruler, --dh-column, --dh-accent and their pairs) and never reads your shadcn theme.
- Set --dh-display for the headline, brand and phone menu, --dh-display-axes for a variable face’s settings, and --dh-text for everything else (defaults to your page font).
- Artboards are links when a project has an href; copies used to fill the endless row are hidden from screen readers and the tab order.
- One requestAnimationFrame loop writes transforms only; it stops when the hero is off screen or the tab is hidden.
- Respects prefers-reduced-motion: no pan and no cursor; the selection still follows pointing and focus.

License: MIT (https://hairlineui.com/license#components)
