Overlay Hero

Poster-style hero: art fills the screen and words sit over it in top, center and bottom slots.

Installation

npx shadcn@latest add @01orbital/overlay-hero

Usage

import { OverlayHero } from "@/components/hero/overlay-hero"
import { BlueHourPhotographicScene } from "@/components/scene/blue-hour-photographic-scene"

// The copy: change text here, not in the markup.
const COPY = {
  brand: "Scarlet.",
  links: "Studio · Projects · Blog",
  tagline: "Interfaces that feel considered.",
  title: "Chloe Design Studio",
} as const

/** Overlay Hero over the Blue Hour Photographic Scene, with its top, center
 * and bottom slots filled. */
export default function OverlayHeroDemo() {
  return (
    <OverlayHero
      className="dark min-h-144 w-full"
      contentClassName="p-6 sm:p-10"
      background={
        <figure className="m-0 size-full overflow-hidden">
          <BlueHourPhotographicScene />
        </figure>
      }
      top={
        <div className="flex justify-between text-sm">
          <span>{COPY.brand}</span>
          <span>{COPY.links}</span>
        </div>
      }
      center={
        <h2 className="text-center font-serif text-5xl sm:text-7xl">
          {COPY.title}
        </h2>
      }
      bottom={<p className="text-sm">{COPY.tagline}</p>}
    />
  )
}

This example installs with everything it uses:

npx shadcn@latest add @01orbital/overlay-hero-demo

API reference

A poster-style hero: art fills the screen and the words sit over it in named slots, top, center and bottom, spread from the top edge to the bottom edge. Use it when the layout is a composition over a picture, such as a masthead, a concert poster or a corner-tagged title, rather than a column of copy. Other props go to the Hero.

Prop

Type

It also accepts the HTML attributes of the element it renders.

Dependencies

npm: cn. The CLI installs it for you.

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

Used in blocks

4 blocks are built with Overlay Hero:

Last updated on