Card with CTA
Combine your cards with a clear call to action
Use the CardwithCta
component to create cards with a clear CTA to encourage user engagement. Use them to promote your products, services, or features with a “Learn More” or “Buy Now” button, encourage sign-ups for newsletters, or drive engagement with content.
Card with CTA
Card with CTA with only the required props
including a title, and a CTA button.
including a title, and a CTA button.
Unlock code How to use the CardwithCta component in Astro
---const ctaButton = { text: 'CTA', theme: 'secondary'}---
<CardwithCta title="Card with CTA" button={ctaButton}> ...</CardwithCta>
The card must be created with the following two required props:
title
: Sets a title for the card.button
: Sets a CTA button for the card. It can accept any validButtonProps
types.
The component can also be created with optional subtitles, using the subTitle
prop:
Card with CTA With additional subtitle
Card with CTA with both titles, CTA, and short description.
Unlock code How to use subtitles
<CardwithCta title="Card with CTA" subTitle="With additional subtitle" button={{ ... }}> ...</CardwithCta>
Cards with Images
You can use the img
prop to create cards with featured images:

Card with CTA Including subtitle
Component with all possible props.
Unlock code How to add images to CTA cards
<CardwithCta title="Card with CTA" subTitle="Including subtitle" img={{ src: '/img/featured.png', alt: 'Featured img alt text', width: 100, height: 150, lazy: true }} button={{ ... }}> Component with all possible props.</CardwithCta>
You can specify the following properties on the image object:
src
: Sets the path to the image.alt
: Sets an alternate text for the image.width
andheight
: Sets the width and height of the image.lazy
: Optionally, set thelazy
property totrue
to lazy-load the image.
API
Unlock code Component API reference
type CardWithCtaProps = { title: string subTitle?: string className?: string bodyClassName?: string img?: { src: string alt: string width: number height: number lazy?: boolean } button: { text: string icon?: string } & ButtonProps} & CardProps
Please see the documentation of the
Card
component for the CardProps
type, and consult the documentation of the Button
component for the ButtonProps
type. Prop | Purpose |
---|---|
title | Sets the title of the card. |
subTitle | Sets the subtitle of the card. |
className | Pass additional CSS classes for the card. |
bodyClassName | Pass additional CSS classes for the body of the card. |
img | Sets an image for the card. |
img.src | Sets the path for the image. |
img.alt | Sets an alternate text for the image. |
img.width | Sets the width of the image. |
img.height | Sets the height of the image. |
img.lazy | Set to true to enable lazy loading for the image. |
button | Sets the CTA for the card. |
button.text | Sets the text of the CTA. |
button.icon | Sets an icon for the CTA. You can pass SVG strings, or an icon type for Astro components. |