Contact Us

CallToAction

DOC-00098 reference implementor, developer

Overview

CallToAction is a CORE-OWNED pure-content section component in src/core/components/sections/CallToAction.astro. It renders a call-to-action block with heading, body text, action buttons, and an optional media panel. Four layout variants control how content, actions, and media are arranged.

CallToAction does not own surface concerns (background, vertical padding, border-radius). Callers compose it inside LayoutSection for full-width bands or SurfaceBox for constrained card-style surfaces.

All CTA buttons include built-in analytics tracking via the cta_click event taxonomy.

Props

PropTypeDefaultDescription
headingstringrequiredCTA heading text
bodystringSupporting body text (max-width 64ch)
headingLevel162Semantic heading level
headingSizexsdisplay"3xl"Visual heading size (decoupled from semantic level)
layout"stacked" | "split" | "split-actions-start" | "split-actions-end""stacked"Layout variant (see Behavior)
mediaSectionMediaImage with src and alt. Required for the split layout to activate.
primaryActionSectionActionPrimary CTA button
secondaryActionSectionActionSecondary CTA button. Only rendered when primaryAction is also present.
as"section" | "div""div"HTML element for the root wrapper
alignSectionAlign"left"Text and content alignment
classstringAdditional CSS classes

All other HTML attributes (id, aria-*, data-*, etc.) are forwarded to the root element via attribute passthrough.

Behavior

Layout variants

The layout prop selects from four arrangement strategies:

  • stacked (default) — Content and actions stack vertically in a single column. Actions appear below the content with lg spacing.
  • split — Content occupies the left column, media occupies the right. At 48rem and above the columns display side-by-side. Requires media — without it, the component falls back to stacked.
  • split-actions-start — Actions appear in the left column, content in the right. Does not use media.
  • split-actions-end — Content in the left column, actions in the right (right-aligned). Does not use media.

Layout resolution

The component applies a guard: layout="split" only takes effect when media is also provided. The split-actions-start and split-actions-end variants activate regardless of media. Any unresolvable layout falls back to "stacked".

Actions

secondaryAction is only rendered when primaryAction is also present. Each action renders as a Button component. The action’s variant defaults to "primary" for the primary action and "secondary" for the secondary action, but can be overridden via the SectionAction.variant field.

Alignment

The align prop controls text alignment and flex alignment of the content column:

  • "left" (default) — left-aligned text and items
  • "center" — centered text and items
  • "right" — right-aligned text and items

Analytics tracking

All CTA buttons carry a data-track-cta attribute. A delegated click listener (registered once per page) captures clicks on these elements and dispatches a cta_click event via the shared trackEvent function with label (button text) and href (link target) in the payload.

CSS API

BEM root class: call-to-action

ClassElement
.call-to-actionBlock root element
.call-to-action__innerInner layout container
.call-to-action__contentContent area (heading + body)
.call-to-action__headingHeading element
.call-to-action__bodyBody text paragraph
.call-to-action__actionsActions container (button row)
.call-to-action__mediaMedia wrapper (split layout only)
.call-to-action__media-imgImage element

Modifier classes applied automatically:

ModifierApplied when
.call-to-action--align-centeralign="center"
.call-to-action--align-rightalign="right"
.call-to-action__inner--splitlayout="split" with media
.call-to-action__inner--split-actions-startlayout="split-actions-start"
.call-to-action__inner--split-actions-endlayout="split-actions-end"

These classes are available as CSS API hooks for site-level overrides in src/site/styles/.

Usage

A CTA inside a full-width section band:

<LayoutSection background="primary" verticalPadding="2xl">
  <CallToAction
    heading="Ready to get started?"
    body="Join thousands of teams already using the platform."
    primaryAction={{ label: "Sign Up", href: "/signup" }}
    align="center"
  />
</LayoutSection>

A CTA as a rounded card inside a constrained surface:

<LayoutSection verticalPadding="2xl">
  <SurfaceBox background="contrast" class="rounded-md py-lg">
    <CallToAction
      heading="Ready to get started?"
      body="Join thousands of teams already using the platform."
      primaryAction={{ label: "Sign Up", href: "/signup" }}
      secondaryAction={{ label: "Contact Sales", href: "/contact" }}
      align="center"
    />
  </SurfaceBox>
</LayoutSection>

A split CTA with media:

<LayoutSection background="contrast" verticalPadding="2xl">
  <CallToAction
    heading="See it in action"
    body="Watch how teams use the platform to ship faster."
    layout="split"
    media={{ src: "/images/demo.jpg", alt: "Product demo" }}
    primaryAction={{ label: "Watch Demo", href: "/demo" }}
  />
</LayoutSection>

Note: To customize CTA appearance at the site level, target the BEM classes above in site-owned stylesheets rather than modifying the core component.

REQ-00208 implemented The system shall provide the C5 section baseline set (`Hero`, `CallToAction`, `InfoCards`, `FeatureGrid`, `Testimonials`) as reusable section components composed from shared primitives.
REQ-00246 implemented The analytics system shall define a shared event taxonomy (page_view, cta_click, form_submit, search_submitted, search_result_clicked) dispatched via a centralized trackEvent function that routes to the dataLayer in GTM format. Event payloads shall follow privacy-safe conventions (no PII, no raw search query text).

Search

Search across pages and articles. Use arrow keys to navigate results.

Search across pages and articles.

Loading search...

Search is unavailable. Please try again later.

    No results for ""

    Try different keywords or fewer words.