Skip to main content

Hero Area ready

When placed at the top of the page hero areas are often the first thing user sees, making them a great place to catch user’s attention with catchy content.

Hero areas can include an illustration in addition to a title, a description, and an action button. Please note that this component takes care of its top and bottom spacing so there should be no need to write custom CSS. If you need to make it play nicely with Duet’s Navigation, use the navDistance property.


Open in new window
description="Tällä sivulla näet vakuutuksiisi liittyvät laskut. Voit myös vaihtaa e-laskutukseen klikkaamalla&nbsp;alta."
button-label="Vaihda e-laskutukseen"


// Select the above hero area component
var hero = document.querySelector("duet-hero")

// Set meta data that is passed when the CTA button is clicked
hero.buttonData = {
type: "action",
message: "Hello World!"

// Listen for click events in the CTA button inside hero area
hero.addEventListener("duetClick", function(e) {
var event = e.detail.originalEvent
console.log("Click detected in hero area:", e.detail)
Open in new window
heading="Eläinvakuutus. Vaivattomasti. Vain muutamassa minuutissa."
button-label="Aloita tästä"

Open in new window
description="Tarjouksemme on voimassa 21.3.2019 saakka. Vakuutuksen myöntämiseen vaikuttaa eläimen terveydentila ja sille voidaan asettaa rajoituksia terveystietojen perusteella. Huomaathan, että tarjous vaatii vielä hyväksynnän."


Properties #

Property Attribute Description Type Default
back -- An object that includes mandatory "label" and "href" fields for the back link. Additionally, you can pass an "id" that is added as an HTML identifier for the element. If nothing is passed, back link won’t be shown. NOTE: The back link can be ONLY used in combination with "gray" style variation. object undefined
buttonData -- An object that includes any data you want to pass to the button. This data will be emitted when the button is clicked. object undefined
buttonId button-id ID for the button. string ""
buttonLabel button-label Text label shown inside the button. If empty, button will be hidden. string ""
buttonUrl button-url URL that the button links to. string "#"
description description The description of the hero area, rendered in a P tag. If empty, description will be hidden. string ""
headerDistance header-distance Adjust hero area’s distance to duet navigation component using this property. Basically adds top margin that matches the sizing of Duet Navigation. Can be one of: "none", "with-links", "without-links". string "none"
heading heading The heading of the hero area, rendered in an H1 tag. P.S. you can control the level of the HTML heading by using “level” prop. If empty, heading will be hidden. string ""
icon icon Icon to display to the left of the button content. If empty, icon will be hidden. string ""
iconRight icon-right Show icon on the right side of the button content. boolean false
iconSize icon-size Icon size for the button. Can be on of: "medium", "large". string "medium"
image image URL of the image shown inside the hero area. The width of the displayed image should be 800px. Optimal aspect ratio is 3:2. If empty, image will be hidden. string ""
level level The level of the heading. Can be one of: "h1", "h2", "h3", "h4", "h5", "h6". string "h1"
margin margin Controls the margin of the component. Can be one of: "auto", "none". string "auto"
navDistance nav-distance Deprecated and will be removed in the future releases. Use headerDistance instead! string ""
theme theme Theme of the hero area. Can be one of: "default", "turva". string ""
variation variation Style variation of the hero area. Can be one of: "default", "light", "gray". string "default"

Events #

Event Description Type
duetClick Callback for when an user clicks the hero area's action button. You can prevent the default browser functionality by calling event.detail.originalEvent.preventDefault() inside yout listener. Additionally, the passed data is available via CustomEvent<any>

Dependencies #

Depends on #

Graph #

graph TD;
duet-hero --> duet-icon
duet-hero --> duet-heading
duet-hero --> duet-paragraph
duet-hero --> duet-button
duet-button --> duet-spinner
style duet-hero fill:#f9f,stroke:#333,stroke-width:4px


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.


Follow these practical tutorials to learn how to build simple page layouts using Duet’s CSS Framework, Web Components and other features:


Building Layouts


Server Side Rendering


If you experience any issues while using a component, please head over to the Support page for more guidelines and help.