Promo card Ready
Promo cards are used to attract interest towards some promoted material with image, text and actions.
Examples #
<style>
.meta {
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 0.75rem;
}
.separator {
display: inline-block;
width: 3px;
height: 3px;
border-radius: 100%;
background: #0077B3;
margin: 0 0.25rem;
}
.turva {
display: none;
}
.duet-theme-turva .turva {
display: block;
}
.duet-theme-turva .lt {
display: none;
}
</style>
<div style="
display: grid;
grid-template-columns: repeat(auto-fill, 344px);
gap: 40px;
">
<duet-promo-card
size="auto"
image="https://www.duetds.com/assets/img/example-banner1.jpg"
icon="category-apartment"
margin="none"
>
<span slot="pre-heading" class="meta">
Etunimi Sukunimi
<span class="separator"></span>
Teema
<span class="separator"></span>
21.3.2023
</span>
<span slot="heading">
Card heading
</span>
<span slot="description">
Card content lorem ipsum dolor sit amet
consectetuer adipiscing elit no nummy laoreet lorem ipsum.
</span>
<duet-button
slot="action"
margin="none"
variation="primary"
size="small"
icon="navigation-arrow-right"
icon-right
>
Call to action
</duet-button>
</duet-promo-card>
<duet-promo-card
size="auto"
image="https://www.duetds.com/assets/img/example-banner1.jpg"
icon="category-apartment"
margin="none"
>
<span slot="pre-heading" class="meta">
Etunimi Sukunimi
<span class="separator"></span>
Teema
<span class="separator"></span>
21.3.2023
</span>
<span slot="heading">
Card heading
</span>
<span slot="description">
Card content lorem ipsum dolor sit amet
consectetuer adipiscing elit no nummy laoreet lorem ipsum.
consectetuer adipiscing elit no nummy laoreet lorem ipsum.
</span>
<duet-button
slot="action"
margin="none"
variation="primary"
size="small"
icon="navigation-arrow-right"
icon-right
>
Call to action
</duet-button>
</duet-promo-card>
<duet-promo-card
class="lt"
size="auto"
image="https://www.duetds.com/assets/img/example-banner1.jpg"
icon="category-apartment"
background-color="primary-lighter"
margin="none"
>
<span slot="pre-heading" class="meta">
Etunimi Sukunimi
<span class="separator"></span>
Teema
<span class="separator"></span>
21.3.2023
</span>
<span slot="heading">
Card heading
</span>
<span slot="description">
Card content lorem ipsum dolor sit amet
consectetuer adipiscing elit no nummy laoreet lorem ipsum.
consectetuer adipiscing elit no nummy laoreet lorem ipsum.
</span>
<duet-button
slot="action"
margin="none"
variation="primary"
size="small"
icon="navigation-arrow-right"
icon-right
>
Call to action
</duet-button>
</duet-promo-card>
<duet-promo-card
class="turva"
size="auto"
image="https://www.duetds.com/assets/img/example-banner1.jpg"
icon="category-apartment"
background-color="gray-lighter"
margin="none"
>
<span slot="pre-heading" class="meta">
Etunimi Sukunimi
<span class="separator"></span>
Teema
<span class="separator"></span>
21.3.2023
</span>
<span slot="heading">
Card heading
</span>
<span slot="description">
Card content lorem ipsum dolor sit amet
consectetuer adipiscing elit no nummy laoreet lorem ipsum.
consectetuer adipiscing elit no nummy laoreet lorem ipsum.
</span>
<duet-button
slot="action"
margin="none"
variation="primary"
size="small"
icon="navigation-arrow-right"
icon-right
>
Call to action
</duet-button>
</duet-promo-card>
</div>
<style>
.meta {
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 0.75rem;
}
.separator {
display: inline-block;
width: 3px;
height: 3px;
border-radius: 100%;
background: #0077B3;
margin: 0 0.25rem;
}
</style>
<div style="
display: grid;
grid-template-columns: repeat(auto-fill, 344px);
gap: 40px;
">
<duet-promo-card
class="lt"
size="auto"
image="https://www.duetds.com/assets/img/example-banner1.jpg"
icon="category-apartment"
background-color="primary-lighter"
margin="none"
url="https://www.lahitapiola.fi/"
>
<span slot="pre-heading" class="meta">
Etunimi Sukunimi
<span class="separator"></span>
Teema
<span class="separator"></span>
21.3.2023
</span>
<span slot="heading">
Card heading
</span>
<span slot="description">
Card content lorem ipsum dolor sit amet
consectetuer adipiscing elit no nummy laoreet lorem ipsum.
consectetuer adipiscing elit no nummy laoreet lorem ipsum.
</span>
<!-- Not using action slot when the whole Promo card is a linf -->
</duet-promo-card>
</div>
Properties #
Property | Attribute | Description | Type | Default |
---|---|---|---|---|
backgroundColor | background-color | Background color. | string | "" |
headingLevel | heading-level | The actual heading level used in the HTML markup. | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "h3" |
image | image | Image. Example image is 512x341; | string | "" |
margin | margin | Controls the margin of the component. | "auto" | "none" | "auto" |
textColor | text-color | Text color. | string | "secondary" |
theme | theme | Theme. | "" | "default" | "turva" | "" |
url | url | A destination to link to, rendered in the href attribute of a link. | string | undefined |
Methods #
setFocus(options?: FocusOptions) => Promise<void>
#
Sets focus on underlying a element.
Available only when url attribute is used.
Use this method instead of the native focus()
.
Parameters #
Name | Type | Description |
---|---|---|
options | FocusOptions |
Returns #
Type: Promise<void>
Slots #
Slot | Description |
---|---|
"action" | Slot for action button. |
"description" | Slot for description content. Only span should be used in this slot. |
"heading" | Slot for heading content. Only span should be used in this slot. |
"pre-heading" | Slot for pre-heading content. |
Usage #
This section includes guidelines for designers and developers about the usage of this component in different contexts.
When to use #
- When you want to have clear promotional content towards certain topic of interest for customers.
When not to use #
- Don't place a Promo card as a sole element in a page.
Accessibility #
This component has been validated to meet the WCAG 2.1 AA accessibility guidelines. You can find additional information regarding accessibility of this component below.
- Promo card is a normal div element with text inside which doesn’t have any added functionality for assistive technologies.
Integration
For integration, event and theming guidelines, please see Using Components. This documentation explains how to implement and use Duet’s components across different technologies like Angular, React or Vanilla JavaScript.
Tutorials
Follow these practical tutorials to learn how to build simple page layouts using Duet’s CSS Framework, Web Components and other features:
Building Layouts
TutorialsUsing CLI Tools
TutorialsCreating Custom Patterns
TutorialsServer Side Rendering
TutorialsSharing Prototypes
TutorialsUsage With Markdown
Troubleshooting
If you experience any issues while using a component, please head over to the Support page for more guidelines and help.