Skip to Content

Centered Hero

Centered hero section composition for landing pages: an optional Announcement pill, headline, description and link buttons, the first filled and the rest outline. Takes an optional background and an h1 or h2 level.

Installation

pnpm dlx shadcn@latest add @01orbital/centered-hero

Usage

import { CenteredHero } from "@/components/hero/centered-hero"

// The copy: change text here, not in the markup.
const COPY = {
  title: "One headline, centered, with room to breathe.",
  description:
    "Centered Hero stacks an announcement, the headline, a line of text and the actions down the middle of the page.",
} as const

const ANNOUNCEMENT = {
  text: "Orbcore 2.0 is out",
  cta: "See what's new",
  href: "#",
} as const

const ACTIONS = [
  { label: "Get started", href: "#" },
  { label: "See examples", href: "#" },
] as const

/** Centered Hero with an announcement, a headline, a description and two
 * actions. */
export default function CenteredHeroDemo() {
  return (
    <CenteredHero
      level={2}
      announcement={ANNOUNCEMENT}
      title={COPY.title}
      description={COPY.description}
      actions={ACTIONS}
      className="w-full"
    />
  )
}

This example installs with everything it uses:

pnpm dlx shadcn@latest add @01orbital/centered-hero-demo

API reference

The block passes any background and decides dark or light.

Prop

Type

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

Dependencies

npm: @phosphor-icons/react, cn. The CLI installs them 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:

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.

Last updated on