# Headline Card

Article or case study card for feature grids: an optional meta line, a display title, a muted description, a round arrow link at the top right and a byline pinned to the bottom so card rows align at equal height.

Component · Card · https://01orbital.dev/docs/components/headline-card

## Installation

```bash
npx shadcn@latest add @01orbital/headline-card
```

## Usage

```tsx
"use client"

import { useState } from "react"

import {
  Byline,
  BylineDescription,
  BylineName,
} from "@/components/byline/byline"
import {
  HeadlineCard,
  HeadlineCardFooter,
  HeadlineCardHeader,
  HeadlineCardMeta,
  HeadlineCardTitle,
} from "@/components/card/headline-card"
import { Eyebrow } from "@/components/eyebrow/eyebrow"
import { ColorWash } from "@/components/scene/color-wash"
import { StatValue } from "@/components/stats/stats"
import { Button } from "@/components/ui/button"

// The copy: change text here, not in the markup.
const COPY = {
  eyebrow: "Web performance",
  title: "Smaller pages, faster first impressions.",
  client: "Ostrelle",
  byline: "Sample case study",
  cta: "Save case study",
  saved: "Saved",
  before: "Before",
  after: "After",
  weight: "Page weight",
} as const

// Page weight in KB; the headline figure is computed from these.
const WEIGHT = { before: 1_200, after: 696 }

// The wash's fields, gold over terracotta: the figure and the after bar are
// painted from them.
const PAINT = {
  gold: "var(--chart-1)",
  ground: "var(--chart-3)",
} as const

const CHANGE = new Intl.NumberFormat("en-US", {
  style: "percent",
  maximumFractionDigits: 0,
  signDisplay: "exceptZero",
})
const SIZE = new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 })

// A typographic minus in place of the hyphen Intl returns.
const formatChange = (value: number) => CHANGE.format(value).replace("-", "−")
const formatSize = (kb: number) => `${SIZE.format(kb / 1000)} MB`

/**
 * A case-study HeadlineCard in the kit's chart style: a dark card on a warm
 * grained wash, a mono label, the change as a mono figure painted from the
 * wash, a before/after pair of bars that shows it and a short headline, with
 * the client and a save button in the footer.
 */
export default function HeadlineCardCaseStudy() {
  const [saved, setSaved] = useState(false)
  const change = WEIGHT.after / WEIGHT.before - 1

  return (
    <div className="dark relative isolate grid min-h-[36rem] w-full place-items-center overflow-hidden p-6 text-foreground sm:p-12">
      {/* The wash is the knob: a light bg-background/20 keeps the cover warm. */}
      <ColorWash color="warmth" className="absolute inset-0" />
      <div aria-hidden="true" className="absolute inset-0 bg-background/20" />
      <HeadlineCard className="relative w-full max-w-md rounded-xl shadow-md ring-1 ring-border [--border:color-mix(in_oklab,currentColor_15%,transparent)] [--muted-foreground:color-mix(in_oklab,var(--foreground)_80%,transparent)]">
        <HeadlineCardHeader>
          <HeadlineCardMeta className="pb-6">
            <div className="grid gap-8">
              <div className="grid gap-4">
                <Eyebrow variant="mono" className="text-current">
                  {COPY.eyebrow}
                </Eyebrow>
                {/* Painted from the wash's ground, not its terracotta, to
                    keep 3:1 against the card. No negative tracking: painted
                    text only fills its box, and tracking would clip the %. */}
                <StatValue
                  className="w-fit bg-clip-text font-mono text-7xl/none font-medium tracking-normal text-transparent"
                  style={{
                    backgroundImage: `linear-gradient(to right, ${PAINT.ground}, ${PAINT.gold})`,
                  }}
                >
                  {formatChange(change)}
                </StatValue>
              </div>
              <dl aria-label={COPY.weight} className="grid gap-3">
                <div className="grid gap-1.5">
                  <div className="flex items-baseline justify-between gap-4">
                    <Eyebrow variant="mono" render={<dt />}>
                      {COPY.before}
                    </Eyebrow>
                    <dd className="font-mono text-sm text-muted-foreground tabular-nums">
                      {formatSize(WEIGHT.before)}
                    </dd>
                  </div>
                  <div
                    aria-hidden="true"
                    className="h-2 w-full rounded-full bg-foreground/25"
                  />
                </div>
                <div className="grid gap-1.5">
                  <div className="flex items-baseline justify-between gap-4">
                    <Eyebrow
                      variant="mono"
                      className="text-current"
                      render={<dt />}
                    >
                      {COPY.after}
                    </Eyebrow>
                    <dd className="font-mono text-sm font-bold tabular-nums">
                      {formatSize(WEIGHT.after)}
                    </dd>
                  </div>
                  <div
                    aria-hidden="true"
                    className="h-2 rounded-full"
                    style={{
                      width: `${(WEIGHT.after / WEIGHT.before) * 100}%`,
                      backgroundImage: `linear-gradient(to right, ${PAINT.ground}, ${PAINT.gold})`,
                    }}
                  />
                </div>
              </dl>
            </div>
          </HeadlineCardMeta>
          <HeadlineCardTitle>{COPY.title}</HeadlineCardTitle>
        </HeadlineCardHeader>
        <HeadlineCardFooter>
          <Byline size="sm">
            <BylineName>{COPY.client}</BylineName>
            <BylineDescription>{COPY.byline}</BylineDescription>
          </Byline>
          <Button
            variant="outline"
            aria-pressed={saved}
            onClick={() => setSaved((v) => !v)}
          >
            {saved ? COPY.saved : COPY.cta}
          </Button>
        </HeadlineCardFooter>
      </HeadlineCard>
    </div>
  )
}
```

This example installs with everything it uses:

```bash
npx shadcn@latest add @01orbital/headline-card-case-study
```

## Dependencies

Requires these pieces. The CLI adds each one that is missing and won't replace a file you already have unless you choose to:

- [Button](https://01orbital.dev/docs/components/button)
- [Card](https://01orbital.dev/docs/components/card)
- [Text](https://01orbital.dev/docs/components/text)

The shadcn parts here are their Base UI versions, and this piece uses Base UI's API. A Radix version you already have won't work with it.

npm: `@phosphor-icons/react`, `cn`

## Examples

- **Headline Card Case Study** (`@01orbital/headline-card-case-study`): Example of the Headline Card as a case study in the chart style: a dark card on a warm wash, a mono label, the change as a mono figure painted from the wash, before and after bars and a short headline, with the client and a save button in the footer.
- **Headline Card Paper Editorial** (`@01orbital/headline-card-paper-editorial`): Example of the Headline Card on warm cardstock for editorial content: a mono label, a large serif headline and a byline with a save button.
- **Headline Card Frost Moon** (`@01orbital/headline-card-frost-moon`): Example of the Headline Card with a blue moon rising behind the top corner: a large serif headline and a short reading note that opens in the footer.
- **Headline Card Linen Interview** (`@01orbital/headline-card-linen-interview`): Example of the Headline Card with a fine linen texture and tighter corners, carrying a long quotation as its headline for an interview.
- **Event Date Headline Card** (`@01orbital/headline-card-clay-event`): Example of the Headline Card for an event: an oversized serif date above the headline and expandable event details in the footer.
- **Headline Card Outline Reading** (`@01orbital/headline-card-outline-reading`): Example of the Headline Card as a plain outlined reading card with no fill and a checklist that opens in the footer.
- **Headline Card Plum Newsletter** (`@01orbital/headline-card-plum-newsletter`): Example of the Headline Card as a newsletter sign-up: a large serif headline with an email field and button in the footer.
- **Headline Card Color Wash Band** (`@01orbital/headline-card-art-journal`): Example of the Headline Card: a painted color wash band across the top and a paper body with a label, headline, byline and save button.
- **Headline Card Shared Rows** (`@01orbital/headline-card-shared-rows`): Example of the Headline Card: two cards side by side in a Grid sharing headline, description and footer rows, so descriptions line up although the headlines differ in length.
- **Headline Card Field Notes** (`@01orbital/headline-card-field-notes`): Example of the Headline Card composed from Card parts on warm paper, with an oversized serif title and a ruled mono byline.

## Used in blocks

- [Bezel Glass Card](https://01orbital.dev/docs/blocks/bezel-glass-card-01)
- [Dark Case Study Card Pair](https://01orbital.dev/docs/blocks/case-studies-02)
- [Frosted Glass Guide Cards](https://01orbital.dev/docs/blocks/guide-cards-01)
