Hero: centered with announcement badge
Centered headline, linked announcement badge, two CTAs and a raised image placeholder. Text rises in on load, then the placeholder.
pnpm dlx shadcn@latest add @haze/hero-centered---
import { ArrowRight } from "@lucide/astro";
import Badge from "../ui/badge.astro";
import Button from "../ui/button.astro";
import Placeholder from "../ui/placeholder.astro";
interface Props {
badge?: string;
badgeHref?: string;
title?: string;
description?: string;
primaryLabel?: string;
primaryHref?: string;
secondaryLabel?: string;
secondaryHref?: string;
/** Use 1 when this hero is the top of the page, 2 when it sits below another heading. */
headingLevel?: 1 | 2;
showPreview?: boolean;
}
const {
badge = "New: automations for recurring work",
badgeHref = "#changelog",
title = "Plan, track and ship work without the busywork",
description = "Driftwork keeps your roadmap, sprints and bug queue in one fast workspace, so the team spends its time on the product instead of the process.",
primaryLabel = "Start for free",
primaryHref = "#start",
secondaryLabel = "Book a demo",
secondaryHref = "#demo",
headingLevel = 1,
showPreview = true,
} = Astro.props;
const Heading = headingLevel === 1 ? "h1" : "h2";
---
<section aria-labelledby="hero-centered-title" class="overflow-hidden bg-background px-6 pt-24 pb-16 sm:pt-32">
<div class="mx-auto flex max-w-3xl animate-rise flex-col items-center text-center">
<Badge href={badgeHref}>
{badge}
<ArrowRight aria-hidden="true" />
</Badge>
<Heading
id="hero-centered-title"
class="mt-6 text-4xl/[1.1] font-semibold tracking-tighter text-balance text-foreground sm:text-6xl/[1.05]"
>
{title}
</Heading>
<p class="mt-6 max-w-2xl text-base/7 text-pretty text-muted-foreground sm:text-lg/8">{description}</p>
<div class="mt-8 flex flex-col gap-3 sm:flex-row">
<Button href={primaryHref} size="lg">{primaryLabel}</Button>
<Button href={secondaryHref} size="lg" variant="outline">{secondaryLabel}</Button>
</div>
</div>
{
showPreview && (
<div class="mx-auto mt-16 max-w-5xl animate-rise [animation-delay:80ms]">
<Placeholder label="Driftwork app showing a sprint board and a velocity chart" elevated class="aspect-[16/9]" />
</div>
)
}
</section>When to use
- The first section of a SaaS landing page
- You have a recent launch to point at from the badge
- A single product screenshot tells the story better than feature bullets
When not to use
- The headline needs a form beside it, such as a waitlist; use hero-split-image instead
- You have no product visual yet; set showPreview to false or pick a text-only hero
Installation
Add the Haze registry to components.json once, then install Hero: centered with announcement badge with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.
pnpm dlx shadcn@latest add @haze/hero-centerednpx shadcn@latest add @haze/hero-centeredyarn dlx shadcn@latest add @haze/hero-centeredbunx --bun shadcn@latest add @haze/hero-centeredFirst time? Registry and theme setup
1. Add to components.json:
{
"registries": {
"@haze": "http://localhost:4329/r/{name}.json"
}
}2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| badge | string | "New: automations for recurring work" | Announcement text inside the pill above the headline. |
| badgeHref | string | "#changelog" | Where the badge links to. |
| title | string | demo headline | Main headline; keep it under about 70 characters. |
| description | string | demo copy | Supporting paragraph under the headline. |
| primaryLabel / primaryHref | string | "Start for free" / "#start" | Primary call to action. |
| secondaryLabel / secondaryHref | string | "Book a demo" / "#demo" | Secondary outline call to action. |
| headingLevel | 1 | 2 | 1 | Heading level of the title. |
| showPreview | boolean | true | Show the product screenshot placeholder. |
Accessibility
- Section is labelled by its heading; the heading level is configurable so the page keeps a single h1.
- The arrow icon is decorative and hidden from assistive technology; the screenshot placeholder has a text alternative.
- The entrance is two short rises (the text group, then the image placeholder 80 ms later). It starts at 40 % opacity, so no text is ever invisible, and it is switched off under prefers-reduced-motion.
Notes for AI
Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.
Install and use
Install the Haze UI block "Hero: centered with announcement badge" with `npx shadcn@latest add @haze/hero-centered`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import HeroCentered from "@/components/haze/blocks/hero-centered.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/blocks/hero-centered.md
Customize with real content
Adapt the Haze hero-centered block for our product. Replace the demo values of these props with our real content: badge, badgeHref, title, description, primaryLabel / primaryHref, secondaryLabel / secondaryHref, headingLevel, showPreview. Keep the layout, the heading level rules and these accessibility details: Section is labelled by its heading; the heading level is configurable so the page keeps a single h1. The arrow icon is decorative and hidden from assistive technology; the screenshot placeholder has a text alternative. The entrance is two short rises (the text group, then the image placeholder 80 ms later). It starts at 40 % opacity, so no text is ever invisible, and it is switched off under prefers-reduced-motion. Do not add raw color classes; use the Haze tokens.
Choose the right block
Before using hero-centered, check it fits: use it when the first section of a saas landing page; you have a recent launch to point at from the badge; a single product screenshot tells the story better than feature bullets. Avoid it when the headline needs a form beside it, such as a waitlist; use hero-split-image instead; you have no product visual yet; set showpreview to false or pick a text-only hero. Alternatives: @haze/hero-split-image.
Dependencies
- npm: @lucide/astro
- @haze/badge
- @haze/button
- @haze/placeholder
- @haze/theme (one-time setup)
Source · Original Haze UI work.