---
title: "Centered Hero · UI SDK — StyleX Blocks"
description: "Centered marketing hero pairing an eyebrow badge, balanced display headline, supporting copy, dual call-to-action buttons, and a wide 16:9 architectural showcase frame."
url: "https://stylexblocks.com/block/ui-sdk/centered-hero/"
agent:
  instructions: "Use this search API to find relevant components and blocks across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://stylexblocks.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Centered Hero block

Centered marketing hero pairing an eyebrow badge, balanced display headline, supporting copy, dual call-to-action buttons, and a wide 16:9 architectural showcase frame.

- Behavior engine: UI SDK
- Category: [Marketing](https://stylexblocks.com/blocks/marketing.md)
- Built with: [Aspect Ratio](https://stylexblocks.com/components/ui-sdk/aspect-ratio.md), [Badge](https://stylexblocks.com/components/ui-sdk/badge.md), [Button](https://stylexblocks.com/components/ui-sdk/button.md), [Heading](https://stylexblocks.com/components/ui-sdk/heading.md), [Icon](https://stylexblocks.com/components/ui-sdk/icon.md), [Section](https://stylexblocks.com/components/ui-sdk/section.md), [Stack](https://stylexblocks.com/components/ui-sdk/stack.md), [Text](https://stylexblocks.com/components/ui-sdk/text.md), [Toast](https://stylexblocks.com/components/ui-sdk/toast.md)
- HTML page: https://stylexblocks.com/block/ui-sdk/centered-hero/

## Install

Configure the project once (sets the behavior engine and import aliases):

```sh
npx stylexblocks init --style ui-sdk
```

Then add the item as source you own:

```sh
npx stylexblocks add centered-hero
```

Equivalent: `npx shadcn add @stylexblocks/centered-hero`. Registry item JSON: https://stylexblocks.com/r/ui-sdk/centered-hero.json

## Usage

```tsx
import { CenteredHero } from "#components/blocks/ui-sdk/centered-hero.tsx";

export function Example() {
  return (
    <div style={{ minHeight: "100dvh" }}>
      <CenteredHero />
    </div>
  );
}
```

## Source

`components/blocks/ui-sdk/centered-hero.tsx`

```tsx
import * as stylex from "@stylexjs/stylex";
import { useCallback, useMemo } from "react";
import { AspectRatio } from "#components/ui/ui-sdk/aspect-ratio.tsx";
import { Badge } from "#components/ui/ui-sdk/badge.tsx";
import { Button } from "#components/ui/ui-sdk/button.tsx";
import { Heading } from "#components/ui/ui-sdk/heading.tsx";
import { Icon } from "#components/ui/ui-sdk/icon.tsx";
import { Section } from "#components/ui/ui-sdk/section.tsx";
import { HStack, VStack } from "#components/ui/ui-sdk/stack.tsx";
import { Text } from "#components/ui/ui-sdk/text.tsx";
import { Toast, Toaster } from "#components/ui/ui-sdk/toast.tsx";
import { semanticColors } from "@stylexblocks/ui/semantic-tokens/colors.stylex.ts";
import { semanticRadii } from "@stylexblocks/ui/semantic-tokens/radii.stylex.ts";
import { semanticShadows } from "@stylexblocks/ui/semantic-tokens/shadows.stylex.ts";
import { accentPalette } from "@stylexblocks/ui/themes/palettes.ts";
import { fonts } from "@stylexblocks/ui/tokens/fonts.stylex.ts";
import { spacing } from "@stylexblocks/ui/tokens/spacing.stylex.ts";
import type { StyleOverrideProps } from "#lib/recipe-props.ts";

const styles = stylex.create({
  root: {
    backgroundColor: semanticColors.bg,
    color: semanticColors.fg,
    fontFamily: fonts.body,
    minHeight: "100%",
    paddingBlock: {
      default: spacing._12,
      "@media (max-width: 640px)": spacing._8,
    },
    paddingInline: spacing._6,
    width: "100%",
  },
  content: {
    marginBlock: "auto",
    maxWidth: "75rem",
    width: "100%",
  },
  header: {
    textAlign: "center",
  },
  headline: {
    marginBlock: 0,
    maxWidth: "18ch",
    textAlign: "center",
    textWrap: "balance",
  },
  description: {
    maxWidth: "54ch",
    textWrap: "balance",
  },
  mediaSection: {
    width: "100%",
  },
  heroFrame: {
    backgroundColor: semanticColors.bgMuted,
    borderColor: semanticColors.border,
    borderRadius: semanticRadii.panelLg,
    borderStyle: "solid",
    borderWidth: "1px",
    boxShadow: semanticShadows.lg,
    marginInline: "auto",
    maxWidth: "75rem",
  },
  heroImage: {
    display: "block",
    height: "100%",
    objectFit: "cover",
    width: "100%",
  },
});

export interface CenteredHeroProps extends StyleOverrideProps {
  /** Optional eyebrow pill displayed above the display headline. */
  eyebrow?: string;
  /** Primary display headline. */
  title?: string;
  /** Supporting subheadline copy. */
  description?: string;
  /** Label for the primary call-to-action button. */
  primaryLabel?: string;
  /** Label for the secondary call-to-action button. */
  secondaryLabel?: string;
  /** Artwork source URL or data URI rendered inside the 16:9 media stage. */
  imageSrc?: string;
  /** Accessible description for the hero artwork. */
  imageAlt?: string;
  /** Called when the primary CTA button is activated. */
  onPrimaryAction?: () => void;
  /** Called when the secondary CTA button is activated. */
  onSecondaryAction?: () => void;
}

/**
 * CenteredHero — marketing hero section pairing a centered display headline,
 * supporting copy, dual call-to-action buttons, and a wide 16:9 full-bleed
 * architectural media stage below the fold line.
 */
export function CenteredHero({
  eyebrow = "Atelier Solis · Monograph 04",
  title = "Spaces shaped by daylight",
  description = "Quiet concrete pavilions, timber courtyards, and coastal studios designed to frame shifting sun and horizon lines.",
  primaryLabel = "Explore projects",
  secondaryLabel = "Book a studio visit",
  imageSrc = "/images/blocks/centered-hero/travertine-pavilion.webp",
  imageAlt = "Sunlit travertine architectural pavilion with three coastal arches and a calm reflecting pool at golden hour",
  onPrimaryAction,
  onSecondaryAction,
  palette,
  style,
}: CenteredHeroProps) {
  const queue = useMemo(() => Toast.createToaster(), []);

  const handlePrimary = useCallback(() => {
    onPrimaryAction?.();
    queue.info("Opening the Monograph 04 project archive…", {
      description: "18 built pavilions and coastal commissions ready to browse.",
    });
  }, [onPrimaryAction, queue]);

  const handleSecondary = useCallback(() => {
    onSecondaryAction?.();
    queue.info("Studio visit calendar opened", {
      description: "Private walkthroughs available in Copenhagen and Lisbon.",
    });
  }, [onSecondaryAction, queue]);

  return (
    <VStack align="center" gap="0" palette={palette} style={[styles.root, style]}>
      <VStack render={<main />} gap="10" style={styles.content}>
        <VStack render={<header />} align="center" gap="6" style={styles.header}>
          <VStack align="center" gap="3">
            {eyebrow ? (
              <Badge variant="subtle" size="md">
                {eyebrow}
              </Badge>
            ) : null}
            <Heading render={<h1 />} size="6xl" style={styles.headline}>
              {title}
            </Heading>
            <Text variant="muted" size="lg" align="center" style={styles.description}>
              {description}
            </Text>
          </VStack>

          <HStack wrap="wrap" justify="center" gap="3">
            <Button
              variant="solid"
              size="lg"
              palette={accentPalette}
              onClick={handlePrimary}
            >
              {primaryLabel}
              <Icon
                size="sm"
                viewBox="0 0 20 20"
                fill="none"
                stroke="currentColor"
                strokeWidth="1.75"
                strokeLinecap="round"
                strokeLinejoin="round"
                aria-hidden="true"
              >
                <path d="M4.5 10h11" />
                <path d="M11 5.5 15.5 10 11 14.5" />
              </Icon>
            </Button>
            <Button variant="surface" size="lg" onClick={handleSecondary}>
              {secondaryLabel}
            </Button>
          </HStack>
        </VStack>

        <Section.Root aria-label="Featured architectural showcase" style={styles.mediaSection}>
          <Section.Body>
            <AspectRatio ratio="wide" rounded="lg" style={styles.heroFrame}>
              <img src={imageSrc} alt={imageAlt} {...stylex.props(styles.heroImage)} />
            </AspectRatio>
          </Section.Body>
        </Section.Root>
      </VStack>

      <Toaster toaster={queue} />
    </VStack>
  );
}
```

Credit: Inspired by [Centered Hero](https://astryx.atmeta.com/playground?template=centered-hero) from Astryx (MIT License · Copyright (c) 2026 Meta Platforms, Inc.)
