Aurora hero with forecast chart

A centred hero over slow curtains of colour mixed from your chart tokens (var(--chart-1) to var(--chart-5)), so the field changes with the theme. Headline, one sentence, two actions and a short note, then a cropped forecast card with an SVG line chart (actuals, dashed plan and its range) rising into the next section. The ribbons only drift when motion is allowed and sit still otherwise.

Hero sectionsBlockTailwind v4

Source

import type { CSSProperties } from "react";
import { ArrowRight } from "lucide-react";
import { cn } from "@/lib/utils";

type Action = { label: string; href: string };

export type HeroAuroraProps = {
  title?: string;
  description?: string;
  primaryAction?: Action;
  secondaryAction?: Action;
  note?: string;
  /** Show the forecast card under the actions. */
  showPreview?: boolean;
  className?: string;
};

const focusRing = "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background";

/* Curtains of colour that lean, stretch and drift sideways, like an aurora seen from below. */
const RIBBONS: { style: CSSProperties; colors: [string, string]; animation: string }[] = [
  { style: { left: "-12%", top: "4%", width: "72%", height: "36%" }, colors: ["var(--chart-1)", "var(--chart-4)"], animation: "chm-ribbon-a 17s" },
  { style: { left: "34%", top: "-4%", width: "78%", height: "34%" }, colors: ["var(--chart-2)", "var(--chart-3)"], animation: "chm-ribbon-b 23s" },
  { style: { left: "6%", top: "24%", width: "58%", height: "26%" }, colors: ["var(--chart-5)", "var(--chart-2)"], animation: "chm-ribbon-b 29s" },
  { style: { left: "52%", top: "20%", width: "56%", height: "28%" }, colors: ["var(--chart-3)", "var(--chart-1)"], animation: "chm-ribbon-a 21s" },
];

const KEYFRAMES = `@keyframes chm-ribbon-a{from{transform:translate3d(-7%,0,0) rotate(-11deg) scaleY(1)}to{transform:translate3d(8%,6%,0) rotate(-4deg) scaleY(1.35)}}
@keyframes chm-ribbon-b{from{transform:translate3d(6%,-3%,0) rotate(9deg) scaleY(1.1)}to{transform:translate3d(-8%,5%,0) rotate(2deg) scaleY(.8)}}`;

export function HeroAurora({
  title = "Forecasts your team can read",
  description = "Northvane turns pipeline, hiring and spend into one plan that updates itself every morning.",
  primaryAction = { label: "Try it free", href: "#signup" },
  secondaryAction = { label: "See a sample plan", href: "#sample" },
  note = "Free for teams of five. Setup takes about ten minutes.",
  showPreview = true,
  className,
}: HeroAuroraProps) {
  return (
    <section aria-labelledby="hero-aurora-title" className={cn("relative isolate overflow-hidden bg-background", className)}>
      <style href="chm-hero-aurora" precedence="default">{KEYFRAMES}</style>
      <div
        aria-hidden="true"
        className="pointer-events-none absolute inset-x-0 top-0 -z-10 h-[78%] [mask-image:linear-gradient(to_bottom,#000_25%,transparent_95%)]"
      >
        <div className="absolute inset-0 opacity-60 blur-[64px] saturate-[1.3] dark:opacity-55">
          {RIBBONS.map((ribbon, index) => (
            <div
              key={index}
              className="absolute rounded-[100%] [animation-direction:alternate] [animation-iteration-count:infinite] [animation-timing-function:ease-in-out] motion-reduce:![animation:none]"
              style={{
                ...ribbon.style,
                background: `linear-gradient(90deg, transparent, ${ribbon.colors[0]} 30%, ${ribbon.colors[1]} 70%, transparent)`,
                animationName: ribbon.animation.split(" ")[0],
                animationDuration: ribbon.animation.split(" ")[1],
              }}
            />
          ))}
        </div>
      </div>

      <div className="mx-auto max-w-6xl px-4 pt-24 sm:px-6 sm:pt-32 lg:px-8 lg:pt-36">
        <div className="mx-auto max-w-3xl text-center">
          <h1
            id="hero-aurora-title"
            className="text-balance text-[2.6rem] font-semibold leading-[1] tracking-[-0.04em] text-foreground sm:text-6xl lg:text-7xl"
          >
            {title}
          </h1>
          <p className="mx-auto mt-6 max-w-xl text-lg leading-relaxed text-foreground/75 sm:text-xl">{description}</p>
          <div className="mt-9 flex flex-wrap justify-center gap-3">
            <a
              href={primaryAction.href}
              className={cn("group inline-flex h-11 items-center gap-2 rounded-md bg-primary px-5 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90", focusRing)}
            >
              {primaryAction.label}
              <ArrowRight className="size-4 motion-safe:transition-transform group-hover:translate-x-0.5" aria-hidden="true" />
            </a>
            <a
              href={secondaryAction.href}
              className={cn("inline-flex h-11 items-center rounded-md bg-background/70 px-5 text-sm font-medium text-foreground ring-1 ring-border transition-colors hover:bg-background", focusRing)}
            >
              {secondaryAction.label}
            </a>
          </div>
          {note && <p className="mt-5 text-sm text-muted-foreground">{note}</p>}
        </div>

        {showPreview ? <ForecastCard /> : <div className="h-24 sm:h-32" />}
      </div>
    </section>
  );
}

/* A cropped forecast: actuals to date, the plan ahead and its range. Drawn in SVG from theme tokens. */
const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
const ACTUAL = [62, 70, 66, 81, 92, 104, 118];
const PLAN = [118, 129, 141, 150, 163, 176];
const x = (index: number) => 20 + index * (760 / 11);
const y = (value: number) => 200 - value;
const line = (values: number[], offset = 0) => values.map((value, index) => `${index ? "L" : "M"}${x(index + offset).toFixed(1)} ${y(value)}`).join(" ");
const band = () => {
  const upper = PLAN.map((value, index) => `${index ? "L" : "M"}${x(index + 6).toFixed(1)} ${y(value + index * 5)}`).join(" ");
  const lower = [...PLAN].reverse().map((value, index) => `L${x(11 - index).toFixed(1)} ${y(value - (5 - index) * 5)}`).join(" ");
  return `${upper} ${lower} Z`;
};

function ForecastCard() {
  return (
    <figure className="relative mx-auto mt-16 max-w-5xl sm:mt-20">
      <div
        data-ui
        className="rounded-t-xl bg-card px-5 pb-6 pt-5 text-card-foreground shadow-[0_-20px_60px_-30px_rgb(0_0_0/0.35)] ring-1 ring-border sm:px-8 sm:pt-7"
      >
        <div className="flex flex-wrap items-end justify-between gap-4">
          <div>
            <p className="text-sm text-muted-foreground">Monthly recurring revenue, $k</p>
            <p className="mt-1 text-3xl font-semibold tracking-tight tabular-nums">$118k <span className="text-base font-medium text-emerald-600 dark:text-emerald-400">+13.5%</span></p>
          </div>
          <div className="flex items-center gap-5 text-xs text-muted-foreground">
            <span className="flex items-center gap-2"><span className="h-0.5 w-5 rounded-full bg-foreground" />Actual</span>
            <span className="flex items-center gap-2"><span className="h-0.5 w-5 rounded-full border-t-2 border-dashed border-chart-2" />Plan</span>
          </div>
        </div>
        <svg viewBox="0 0 800 205" className="mt-6 h-auto w-full" role="img" aria-label="Revenue rose from 62k in January to 118k in July; the plan reaches 176k by December">
          {[40, 80, 120, 160].map((value) => (
            <line key={value} x1="20" x2="780" y1={y(value)} y2={y(value)} stroke="var(--border)" strokeWidth="1" vectorEffect="non-scaling-stroke" />
          ))}
          <path d={band()} fill="var(--chart-2)" opacity="0.14" />
          <path d={`${line(ACTUAL)} L${x(6)} 200 L${x(0)} 200 Z`} fill="var(--foreground)" opacity="0.05" />
          <path d={line(ACTUAL)} fill="none" stroke="var(--foreground)" strokeWidth="2.5" strokeLinejoin="round" strokeLinecap="round" vectorEffect="non-scaling-stroke" />
          <path d={line(PLAN, 6)} fill="none" stroke="var(--chart-2)" strokeWidth="2.5" strokeDasharray="6 6" strokeLinecap="round" vectorEffect="non-scaling-stroke" />
          <line x1={x(6)} x2={x(6)} y1="20" y2="200" stroke="var(--muted-foreground)" strokeDasharray="2 4" vectorEffect="non-scaling-stroke" />
          <circle cx={x(6)} cy={y(118)} r="6" fill="var(--background)" stroke="var(--foreground)" strokeWidth="2.5" vectorEffect="non-scaling-stroke" />
        </svg>
        <div aria-hidden="true" className="relative mt-2 h-4 text-xs text-muted-foreground">
          {MONTHS.map((month, index) => (
            <span
              key={month}
              className={cn("absolute -translate-x-1/2", index % 2 === 1 && "max-sm:hidden")}
              style={{ left: `${(x(index) / 800) * 100}%` }}
            >
              {month}
            </span>
          ))}
        </div>
      </div>
      <figcaption className="sr-only">Sample Northvane revenue forecast</figcaption>
    </figure>
  );
}