Skip to main content

Stepper
New

This template shows how to use Duet’s Stepper and Step components to create a purchase flow. Please note that the example below does not represent a real use case.

Hint: Press F on your keyboard to view both templates and components in fullscreen and ESC to exit the fullscreen mode. You can also open the template in a new browser window.


Open in new window
<!DOCTYPE html>
<html class="duet-bg-gradient duet-sticky-footer" lang="fi">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>LähiTapiola</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@duetds/fonts@latest/lib/localtapiola.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@duetds/css@latest/lib/duet.min.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@duetds/tokens@latest/lib/tokens.custom-properties.css" />
<script type="module" src="https://cdn.jsdelivr.net/npm/@duetds/components@3.4.11/lib/duet/duet.esm.js"></script>
<script nomodule src="https://cdn.jsdelivr.net/npm/@duetds/components@3.4.11/lib/duet/duet.js"></script>
</head>
<body>
<duet-header language="fi" skip-to-id="#content"></duet-header>
<duet-hero
heading="Eläinvakuutus. Vaivattomasti. Vain muutamassa minuutissa."
image="https://www.duetds.com/assets/img/illustrations/placeholder-dark.svg"
button-label="Aloita tästä"
variation="light"
button-url="#start"
margin="none"
icon="navigation-arrow-down"
icon-right
id="content"
header-distance="without-links">

</duet-hero>
<duet-layout id="start" sticky sticky-top="456" sticky-distance="without-links">
<div slot="main">
<duet-stepper>
<duet-step heading="Perustiedot">
<duet-caption>
Tee valinnat ja täytä kaikki kentät, ellei toisin mainita. Huomaathan, että vakuutuksen
myöntämiseen vaikuttaa eläimen terveyden tila.
</duet-caption>
<duet-spacer size="x-small"></duet-spacer>
<duet-choice-group value="1" label="Millainen lemmikkisi on?" direction="horizontal" name="group" responsive>
<duet-choice label="Koira" type="radio" value="1" expand></duet-choice>
<duet-choice label="Kissa" type="radio" value="2" expand></duet-choice>
<duet-choice label="Hevonen" type="radio" value="3" expand></duet-choice>
</duet-choice-group>
<duet-input label="Rotu" name="rotu" placeholder="Labradorinnoutaja" expand required></duet-input>
<duet-grid responsive breakpoint="medium" direction="horizontal" alignment="stretch">
<duet-input label="Syntymäaika" name="rotu" placeholder="24.8.2011" expand required></duet-input>
<duet-grid-item min-width="calc(66.666% + 8px)" fill></duet-grid-item>
</duet-grid>
<duet-grid responsive breakpoint="medium" direction="horizontal" alignment="stretch">
<duet-input label="Nimi" name="name" placeholder="Lila" expand required></duet-input>
<duet-grid-item min-width="calc(33.333% + 8px)" fill></duet-grid-item>
</duet-grid>
<duet-spacer size="large"></duet-spacer>
<duet-grid responsive breakpoint="medium" direction="horizontal" alignment="stretch">
<duet-button variation="primary" class="next" expand wrapping="none">Laske hinta</duet-button>
<duet-grid-item min-width="calc(66.666% + 8px)" fill></duet-grid-item>
</duet-grid>
</duet-step>
<duet-step heading="Tarkemmat tiedot">
<duet-caption>
Lorem ipsum dolor sit amet consectetuer adipiscing elit no nummy laoreet ipsum dolor sit
amet consectetuer adipiscing elit no nummy laoreet consectetuer adipiscing.
</duet-caption>
<duet-button variation="primary" class="next">Seuraava</duet-button>
</duet-step>
<duet-step heading="Vakuutustiedot">
<duet-caption>
Lorem ipsum dolor sit amet consectetuer adipiscing elit no nummy laoreet ipsum dolor sit
amet consectetuer adipiscing elit no nummy laoreet consectetuer adipiscing.
</duet-caption>
<duet-button variation="primary" class="next">Seuraava</duet-button>
</duet-step>
<duet-step heading="Yhteenveto">
<duet-caption>
Lorem ipsum dolor sit amet consectetuer adipiscing elit no nummy laoreet ipsum dolor sit
amet consectetuer adipiscing elit no nummy laoreet consectetuer adipiscing.
</duet-caption>
<duet-button variation="primary" class="next">Seuraava</duet-button>
</duet-step>
<duet-step heading="Terveysselvitys">
<duet-caption>
Lorem ipsum dolor sit amet consectetuer adipiscing elit no nummy laoreet ipsum dolor sit
amet consectetuer adipiscing elit no nummy laoreet consectetuer adipiscing.
</duet-caption>
</duet-step>
</duet-stepper>
</div>
<div slot="sidebar">
<duet-card padding="medium">
<duet-heading level="h3" visual-level="h4">Vakuutuksen hinta valintasi perusteella</duet-heading>
<duet-label>Vuosimaksu</duet-label>
<duet-caption>Täytä perustiedot nähdäksesi hinta.</duet-caption>
</duet-card>
<duet-card padding="medium">
<duet-grid direction="horizontal">
<duet-grid-item margin="none">
<duet-icon class="duet-color-primary" size="large" name="messaging-terms" class="themed-icon">
</duet-icon>
</duet-grid-item>
<duet-grid-item margin="none">
<duet-spacer direction="horizontal"></duet-spacer>
</duet-grid-item>
<duet-grid-item fill margin="none">
<duet-paragraph margin="none">
Tutustu <duet-link url="#">vakuutuksen ehtoihin</duet-link>,
<duet-link url="#">tuoteselosteeseen</duet-link> ja
<duet-link url="#">avaintietohin</duet-link>
</duet-paragraph>
</duet-grid-item>
</duet-grid>
</duet-card>
</div>
</duet-layout>
<duet-footer logo-href="#" language="fi"></duet-footer>
<script>
// Save references to components we want to adjust below
var header = document.querySelector("duet-header")
var footer = document.querySelector("duet-footer")
var stepper = document.querySelector("duet-stepper")
var nextButtons = document.querySelectorAll("duet-button.next")

// Set the language menu items
header.languageItems = [
{ label: "Suomeksi", country: "fi", href: "/?lang=fi" },
{ label: "På Svenska", country: "sv", href: "/?lang=sv" },
{ label: "In English", country: "en", href: "/?lang=en" }
]

// Set the contact menu items
header.contactItems = [
{ label: "Lähetä viesti", href: "/viestit/laheta" },
{ label: "Avaa chat", href: "/chat/" },
{ label: "Yhteystiedot", href: "/yhteystiedot/" }
]

// Set label and href for session link
header.session = {
label: "Kirjaudu ulos",
href: "/?logout",
type: "logout"
}

// Set label and href for user profile link
header.user = {
label: "Laura",
href: "/?userId=1234"
}

// Listen for change events inside the navigation component
header.addEventListener("duetChange", function(ev) {
var event = ev.detail.originalEvent
var data = ev.detail.data
if (data.href !== "#content") {
event.preventDefault()
}
})

// when "next" button is clicked, advance to next step
nextButtons.forEach(function(button) {
button.addEventListener("click", function() {
stepper.selected++
})
})

// duetStepChange event is raised whenever a step heading is clicked
// when this happens, change to that step
stepper.addEventListener("duetStepChange", function(e) {
stepper.selected = e.detail.toStep
})

// Set the main links in footer
footer.items = [
{ label: 'Hae korvausta', href: '#', icon: 'navigation-make-claim' },
{ label: 'Osta vakuutus', href: '#', icon: 'action-buy-insurance' },
{ label: 'Yhteystiedot', href: '#', icon: 'form-tel' }
]

// Set the help menu items in footer
footer.menu = [
{ label: 'Turvallisuus ja käyttöehdot', href: '#' },
{ label: 'Evästeet', href: '#' },
{ label: 'Henkilötietojen käsittely', href: '#' },
]
</script>
</body>
</html>

Integration

To install this template’s dependencies into your project, run:

npm install @duetds/components --save-dev
npm install @duetds/css --save-dev
npm install @duetds/fonts --save-dev

For further guidelines, please see each package’s documentation.



Tutorials

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

Tutorials

Building Layouts

Tutorials

Using CLI Tools

Tutorials

Creating Custom Patterns

Tutorials

Server Side Rendering

Tutorials

Sharing Prototypes


Troubleshooting

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