CtaCenteredpopular

apps/www/src/sections/CtaCentered.astro · 36 lines · group Call to action

CtaCentered — a short centered prompt with the buttons under it. Without a `title` it is a quiet one-line invitation: muted text, one button.

In the fleet

Used on 2 sites built with this engine.

Samples 2

sample

Not sure which station fits?

Send us the field and the crop — we answer with a plan, not a quote.

MDX of this sample
<CtaCentered
  title="Not sure which station fits?"
  description="Send us the field and the crop — we answer with a plan, not a quote."
  primaryText="Ask us"
  primaryHref="/contact/"
/>
sample

Every station ships with a two-year warranty and a spare sensor.

MDX of this sample
<CtaCentered
  description="Every station ships with a two-year warranty and a spare sensor."
  primaryText="See what is in the box"
  primaryHref="/box/"
/>

Props

NameTypeRequiredDefaultDescription
idstring
titlestring
highlightstringa second line under the title, in a lighter weight
descriptionstring
themeTheme'light'
primaryTextstring
primaryHrefstring'#'
secondaryTextstring
secondaryHrefstring'#'

Source apps/www/src/sections/CtaCentered.astro @ gitt.one

---
/**
 * CtaCentered — a short centered prompt with the buttons under it. Without a
 * `title` it is a quiet one-line invitation: muted text, one button.
 */
import Section from './_Section.astro';
import type { Theme } from './_Section.astro';
import Button from './_Button.astro';

interface Props {
  id?: string;
  title?: string;
  /** a second line under the title, in a lighter weight */
  highlight?: string;
  description?: string;
  theme?: Theme;
  primaryText?: string;
  primaryHref?: string;
  secondaryText?: string;
  secondaryHref?: string;
}
const { id, title, highlight, description, theme = 'light', primaryText, primaryHref = '#', secondaryText, secondaryHref = '#' } = Astro.props;
const dark = theme === 'dark' || theme === 'brand';
---

<Section id={id} theme={theme}>
  <div class="mx-auto max-w-4xl text-center">
    {title && <h2 class="text-2xl font-bold tracking-tight">{title}{highlight && <span class="block font-normal text-gray-500 [.bg-stone-800_&]:text-primary-100">{highlight}</span>}</h2>}
    {description && <p class:list={['text-lg text-gray-500', title && 'mt-4']}>{description}</p>}
    <div class="mt-8 flex flex-wrap justify-center gap-4">
      {primaryText && <Button href={primaryHref}>{primaryText}</Button>}
      {secondaryText && <Button href={secondaryHref} kind="secondary" onDark={dark}>{secondaryText}</Button>}
    </div>
  </div>
</Section>

Source links point to engine-astro@38c294d9. Samples are demo content: the components are the real ones, the copy and the pictures are made up.