Search documentation v0.8.1

Promotional Card

Highlight announcements and offers

Source ↗️ Report Issue ↗️

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.

New components v1.2.0 • 2024 March 12
Explore Our New Release Introducing new components for our library! Check out our full changelog below.
Unlock code
How to use the PromotionalCard component in Astro
---
const promotionalCardProps = {
img: {
src: '/img/featured.png',
alt: 'Featured image',
height: 150,
width: 500
},
badge: {
text: 'New components',
theme: 'success',
rounded: true,
small: true
},
buttons: [{ text: 'See changes ->', theme: 'secondary' }],
meta: 'v1.2.0 • 2024 March 12',
title: 'New Release',
secondary: true
}
---
<PromotionalCard {...promotionalCardProps}>
<span class="muted">Introducing new components for our library!</span>
</PromotionalCard>

The PromotionalCard component accepts a number of different props, including:

Using images, badges, meta details, and buttons are optional, meaning you can use this component in various configurations:

Card with Title and Button Only Introducing new components for our library!
Badge with icon Card with Badge Introducing new components for our library!
Breaking changes v1.2.0
Badge + Meta Introducing new components for our library!

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:

Unlock code
How to turn the promotional card into a promotional popup
---
import { Button, Modal } from 'webcoreui/astro'
---
<Button className="popup-trigger">Show Promotional Popup</Button>
<Modal className="popup" transparent={true} showCloseIcon={false}>
<PromotionalCard {...props}>...</PromotionalCard>
</Modal>
<script>
import { modal } from 'webcoreui'
modal({
trigger: '.popup-trigger',
modal: '.popup'
})
</script>
New components v1.2.0 • 2024 March 12
Explore Our New Release Introducing new components for our library! Check out our full changelog below.

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

Unlock code
Component API reference
type PromotionalCardProps = {
img?: {
src: string
alt: string
width: number
height: number
lazy?: boolean
}
badge?: ({
text: string
icon?: string
} & BadgeProps)
meta?: string
title: string
buttons?: ({
text: string
icon?: string
} & ButtonProps)[]
className?: string
} & CardProps

You can find more details about the different prop types on the following pages:

PropPurpose
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