Promotional Card
Highlight announcements and offers
Use the PromotionalCard
component to highlight announcements and offers in a visually compelling way. They can increase visibility and improve engagement. Use them to announce product launches, events, or new features, or to highlight discounts, limited-time deals, or seasonal campaigns.
The PromotionalCard
component accepts a number of different props, including:
img
: Defines a featured image for the component. You can use thesrc
,alt
,width
, andheight
attributes to set the attributes of your image. You can also set thelazy
property totrue
to lazy load the image.badge
: Defines a badge above the title. For this object, you can use the props of aBadge
component, along with atext
property to set the text of the badge, and anicon
property to assign an icon for the badge. Theicon
prop can take the value of an SVG string, or use one of the icon types defined here.buttons
: Defines a list of buttons. You can use the props of aButton
component, along with atext
andicon
property in a similar way to thebadge
prop.meta
: Defines additional text shown next to the badge.title
: Defines the title of the promotional card.secondary
: ThePromotionalCard
component extends theCard
component, meaning you can use anyCard
prop on yourPromotionalCard
to customize its appearance. Thesecondary
prop is specific to theCard
component.
Using images, badges, meta details, and buttons are optional, meaning you can use this component in various configurations:
Promotional Popup
You can combine the PromotionalCard
component with a transparent Modal
component to create promotional popups. To achieve this, simply pass your PromotionalCard
inside a Modal
component in the following way:
You can also assign the modal
instance to a variable and call modal.open
to trigger the modal programmatically via JavaScript. You can read more about how to work with the Modal
component in its documentation.
API
You can find more details about the different prop types on the following pages:
Prop | Purpose |
---|---|
img | Sets a thumbnail 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. |
badge | Sets a badge above the title. |
badge.text | Sets the text for the badge. |
badge.icon | Sets an icon for the badge. You can pass SVG strings, or an icon type for Astro components. |
meta | Sets additional text next to the badge. |
title | Sets the title of the card. |
buttons | Sets CTA buttons at the bottom of the card. |
badge.text | Sets the label for the CTAs. |
badge.icon | Sets an icon for the CTAs. You can pass SVG strings, or an icon type for Astro components. |
className | Pass additional CSS classes for the PromotionalCard component. |
Request improvement for this page