Skip to main content

Load More
New

This template shows how to build a simple load more pattern that utilizes Button component’s loading state. 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@1.3.12/lib/localtapiola.css" integrity="sha384-5JYmtSD7nykpUvSmTW1CHMoBDkBZUpUmG0vuh+NUVtZag3F75Kr7+/JU3J7JV6Wq" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@duetds/css@1.4.6/lib/duet.min.css" integrity="sha384-pCjsyofCzuxv5DPuTf+kg3QNWqVN0ZwRTCgvvNWCkI38A42MtkN2EK2I2e28j+wB" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@duetds/tokens@2.0.30/lib/tokens.custom-properties.css" integrity="sha384-arb0dRY7eabL9qYMLabGqlrgO9p75pZ9lvaqh3xpLpNUUW6KBtRjKqkSwBv3HyLp" crossorigin="anonymous" />
<script type="module" src="https://cdn.jsdelivr.net/npm/@duetds/components@4.2.6/lib/duet/duet.esm.js" integrity="sha384-ytNH4bICrleu6OXiFr0GctdjoojY5a4B3/H3+Z0wTQOB9eUcbh6i7GbP2QykjM4k" crossorigin="anonymous"></script>
<script nomodule src="https://cdn.jsdelivr.net/npm/@duetds/components@4.2.6/lib/duet/duet.js" integrity="sha384-j/SZhqGHRSMeQPpiO0sIu1NANTpsXU23YSk3+nfvGaUM9SvRrOaN15rhsFO4k6L4" crossorigin="anonymous"></script>
</head>
<body>
<style>
.load {
transition: 500ms 100ms ease;
opacity: 0;
visibility: hidden;
}
.load.active {
opacity: 1;
visibility: visible;
}
</style>
<duet-header
language="fi"
skip-to-id="#content"
contact="Ota yhteyttä"
current-href="/vakuutukset/"
items='[
{ "label": "Etusivu","href": "/" },
{ "label": "Vakuutukset", "href": "/vakuutukset/" },
{ "label": "Vahinkoasiat", "href": "#" },
{ "label": "Säästöt ja sijoitukset", "href": "#" },
{ "label": "Laskut", "href": "#", "badge": "true" },
{ "label": "Viestit", "href": "#" }
]'

language-items='[
{ "label": "Suomeksi", "country": "fi", "href": "/?lang=fi" },
{ "label": "På Svenska", "country": "sv", "href": "/?lang=sv" },
{ "label": "In English", "country": "en", "href": "/?lang=en" }
]'

contact-items='[
{ "label": "Lähetä viesti", "href": "/viestit/laheta" },
{ "label": "Avaa chat", "href": "/chat/" },
{ "label": "Yhteystiedot", "href": "/yhteystiedot/" }
]'

session='{ "label": "Kirjaudu ulos", "href": "/?logout", "type": "logout" }'
user='{ "label": "Elina", "href": "/?userId=elina" }'>

</duet-header>
<duet-layout header-distance="with-links" id="content">
<div slot="main">
<duet-visually-hidden>
<duet-heading level="h1">Vakuutukset</duet-heading>
</duet-visually-hidden>
<duet-grid alignment="center" direction="vertical">
<duet-grid-item max-width="920px" fill>
<duet-card accessible-label="Pariturva-henkivakuutus, Laura-Karoliina Mäkinen" url="#" padding="large">
<duet-grid responsive distribution="space-between" alignment="top">
<duet-grid alignment="center" responsive breakpoint="medium">
<duet-grid-item fill>
<duet-heading level="h2" visual-level="h3">Pariturva-henkivakuutus</duet-heading>
<duet-spacer size="xx-small"></duet-spacer>
<duet-list padding="none" margin="none">
<duet-list-item>
<span slot="label">Hakemuksen luoja</span>
<span slot="value">Laura-Karoliina Mäkinen</span>
</duet-list-item>
<duet-list-item>
<span slot="label">Vakuutusmäärä</span>
<span slot="value">55&nbsp;000,00&nbsp;</span>
</duet-list-item>
<duet-list-item>
<span slot="label">Hinta</span>
<span slot="value">480,77&nbsp;€ / vuosi</span>
</duet-list-item>
<duet-list-item>
<span slot="label">Hakemus luotu</span>
<span slot="value">20.2.2020</span>
</duet-list-item>
</duet-list>
</duet-grid-item>
<duet-grid-item margin="none">
<duet-grid mobile="center">
<duet-spacer breakpoint="medium" direction="horizontal" size="xxxx-large">
</duet-spacer>
<duet-button tabindex="-1" wrapping="none" margin="none" variation="primary">
Valitse
</duet-button>
</duet-grid>
<duet-spacer breakpoint="x-small" direction="vertical" size="large"></duet-spacer>
</duet-grid-item>
</duet-grid>
</duet-grid>
</duet-card>
<duet-card accessible-label="Pariturva-henkivakuutus, Minna Mikkola" url="#" padding="large">
<duet-grid responsive distribution="space-between" alignment="top">
<duet-grid alignment="center" responsive breakpoint="medium">
<duet-grid-item fill>
<duet-heading level="h2" visual-level="h3">Pariturva-henkivakuutus</duet-heading>
<duet-spacer size="xx-small"></duet-spacer>
<duet-list padding="none" margin="none">
<duet-list-item>
<span slot="label">Hakemuksen luoja</span>
<span slot="value">Minna Mikkola</span>
</duet-list-item>
<duet-list-item>
<span slot="label">Vakuutusmäärä</span>
<span slot="value">80&nbsp;000,00&nbsp;</span>
</duet-list-item>
<duet-list-item>
<span slot="label">Hinta</span>
<span slot="value">620,80&nbsp;€ / vuosi</span>
</duet-list-item>
<duet-list-item>
<span slot="label">Hakemus luotu</span>
<span slot="value">1.5.2019</span>
</duet-list-item>
</duet-list>
</duet-grid-item>
<duet-grid-item margin="none">
<duet-grid mobile="center">
<duet-spacer breakpoint="medium" direction="horizontal" size="xxxx-large">
</duet-spacer>
<duet-button tabindex="-1" wrapping="none" margin="none" variation="primary">
Valitse
</duet-button>
</duet-grid>
<duet-spacer breakpoint="x-small" direction="vertical" size="large"></duet-spacer>
</duet-grid-item>
</duet-grid>
</duet-grid>
</duet-card>
<duet-card accessible-label="Pariturva-henkivakuutus, Hanna Koskinen" url="#" padding="large">
<duet-grid responsive distribution="space-between" alignment="top">
<duet-grid alignment="center" responsive breakpoint="medium">
<duet-grid-item fill>
<duet-heading level="h2" visual-level="h3">Pariturva-henkivakuutus</duet-heading>
<duet-spacer size="xx-small"></duet-spacer>
<duet-list padding="none" margin="none">
<duet-list-item>
<span slot="label">Hakemuksen luoja</span>
<span slot="value">Hanna Koskinen</span>
</duet-list-item>
<duet-list-item>
<span slot="label">Vakuutusmäärä</span>
<span slot="value">48&nbsp;000,00&nbsp;</span>
</duet-list-item>
<duet-list-item>
<span slot="label">Hinta</span>
<span slot="value">426,30&nbsp;€ / vuosi</span>
</duet-list-item>
<duet-list-item>
<span slot="label">Hakemus luotu</span>
<span slot="value">22.1.2019</span>
</duet-list-item>
</duet-list>
</duet-grid-item>
<duet-grid-item margin="none">
<duet-grid mobile="center">
<duet-spacer breakpoint="medium" direction="horizontal" size="xxxx-large">
</duet-spacer>
<duet-button tabindex="-1" wrapping="none" margin="none" variation="primary">
Valitse
</duet-button>
</duet-grid>
<duet-spacer breakpoint="x-small" direction="vertical" size="large"></duet-spacer>
</duet-grid-item>
</duet-grid>
</duet-grid>
</duet-card>
<duet-card accessible-label="Pariturva-henkivakuutus, Anna Grönlund" url="#" padding="large">
<duet-grid responsive distribution="space-between" alignment="top">
<duet-grid alignment="center" responsive breakpoint="medium">
<duet-grid-item fill>
<duet-heading level="h2" visual-level="h3">Pariturva-henkivakuutus</duet-heading>
<duet-spacer size="xx-small"></duet-spacer>
<duet-list padding="none" margin="none">
<duet-list-item>
<span slot="label">Hakemuksen luoja</span>
<span slot="value">Anna Grönlund</span>
</duet-list-item>
<duet-list-item>
<span slot="label">Vakuutusmäärä</span>
<span slot="value">90&nbsp;000,00&nbsp;</span>
</duet-list-item>
<duet-list-item>
<span slot="label">Hinta</span>
<span slot="value">822,40&nbsp;€ / vuosi</span>
</duet-list-item>
<duet-list-item>
<span slot="label">Hakemus luotu</span>
<span slot="value">6.2.2018</span>
</duet-list-item>
</duet-list>
</duet-grid-item>
<duet-grid-item margin="none">
<duet-grid mobile="center">
<duet-spacer breakpoint="medium" direction="horizontal" size="xxxx-large">
</duet-spacer>
<duet-button tabindex="-1" wrapping="none" margin="none" variation="primary">
Valitse
</duet-button>
</duet-grid>
<duet-spacer breakpoint="x-small" direction="vertical" size="large"></duet-spacer>
</duet-grid-item>
</duet-grid>
</duet-grid>
</duet-card>
<div class="load"></div>
</duet-grid-item>
<duet-spacer direction="vertical"></duet-spacer>
<duet-grid alignment="center" distribution="center">
<duet-button class="button" variation="secondary">Lataa lisää</duet-button>
</duet-grid>
</duet-grid>
</div>
</duet-layout>
<duet-footer
logo-href="#"
language="fi"
items='[
{ "label": "Hae korvausta", "href": "#", "icon": "navigation-make-claim" },
{ "label": "Osta vakuutus", "href": "#", "icon": "action-buy-insurance" },
{ "label": "Yhteystiedot", "href": "#", "icon": "form-tel" }
]'

menu='[
{ "label": "Turvallisuus ja käyttöehdot", "href": "#" },
{ "label": "Evästeet", "href": "#" },
{ "label": "Henkilötietojen käsittely", "href": "#" }
]'
>

</duet-footer>
<duet-visually-hidden>
<span aria-live="assertive"></span>
</duet-visually-hidden>
<script>
// Save references to components we want to adjust below
var button = document.querySelector(".button")
var load = document.querySelector(".load")
var aria = document.querySelector("duet-visually-hidden span")

// When using campaign code, change UI state
button.addEventListener("click", function(e) {
e.preventDefault()
button.loading = true
var clone = document.createElement("div")
clone.innerHTML = "<duet-card accessible-label='Pariturva-henkivakuutus, Laura-Karoliina Mäkinen' url='#' padding='large'><duet-grid responsive distribution='space-between' alignment='top'><duet-grid alignment='center' responsive breakpoint='medium'><duet-grid-item fill><duet-heading level='h2' visual-level='h3'>Pariturva-henkivakuutus</duet-heading><duet-spacer size='xx-small'></duet-spacer><duet-list padding='none' margin='none'><duet-list-item><span slot='label'>Hakemuksen luoja</span><span slot='value'>Laura-Karoliina Mäkinen</span></duet-list-item><duet-list-item><span slot='label'>Vakuutusmäärä</span><span slot='value'>55&nbsp;000,00&nbsp;€</span></duet-list-item><duet-list-item><span slot='label'>Hinta</span><span slot='value'>480,77&nbsp;€ / vuosi</span></duet-list-item><duet-list-item><span slot='label'>Hakemus luotu</span><span slot='value'>20.2.2020</span></duet-list-item></duet-list></duet-grid-item><duet-grid-item margin='none'><duet-grid mobile='center'><duet-spacer breakpoint='medium' direction='horizontal' size='xxxx-large'></duet-spacer><duet-button tabindex='-1' wrapping='none' margin='none' variation='primary'>Valitse</duet-button></duet-grid><duet-spacer breakpoint='x-small' direction='vertical' size='large'></duet-spacer></duet-grid-item></duet-grid></duet-grid></duet-card><duet-card accessible-label='Pariturva-henkivakuutus, Minna Mikkola' url='#' padding='large'><duet-grid responsive distribution='space-between' alignment='top'><duet-grid alignment='center' responsive breakpoint='medium'><duet-grid-item fill><duet-heading level='h2' visual-level='h3'>Pariturva-henkivakuutus</duet-heading><duet-spacer size='xx-small'></duet-spacer><duet-list padding='none' margin='none'><duet-list-item><span slot='label'>Hakemuksen luoja</span><span slot='value'>Minna Mikkola</span></duet-list-item><duet-list-item><span slot='label'>Vakuutusmäärä</span><span slot='value'>80&nbsp;000,00&nbsp;€</span></duet-list-item><duet-list-item><span slot='label'>Hinta</span><span slot='value'>620,80&nbsp;€ / vuosi</span></duet-list-item><duet-list-item><span slot='label'>Hakemus luotu</span><span slot='value'>1.5.2019</span></duet-list-item></duet-list></duet-grid-item><duet-grid-item margin='none'><duet-grid mobile='center'><duet-spacer breakpoint='medium' direction='horizontal' size='xxxx-large'></duet-spacer><duet-button tabindex='-1' wrapping='none' margin='none' variation='primary'>Valitse</duet-button></duet-grid><duet-spacer breakpoint='x-small' direction='vertical' size='large'></duet-spacer></duet-grid-item></duet-grid></duet-grid></duet-card><duet-card accessible-label='Pariturva-henkivakuutus, Hanna Koskinen' url='#' padding='large'><duet-grid responsive distribution='space-between' alignment='top'><duet-grid alignment='center' responsive breakpoint='medium'><duet-grid-item fill><duet-heading level='h2' visual-level='h3'>Pariturva-henkivakuutus</duet-heading><duet-spacer size='xx-small'></duet-spacer><duet-list padding='none' margin='none'><duet-list-item><span slot='label'>Hakemuksen luoja</span><span slot='value'>Hanna Koskinen</span></duet-list-item><duet-list-item><span slot='label'>Vakuutusmäärä</span><span slot='value'>48&nbsp;000,00&nbsp;€</span></duet-list-item><duet-list-item><span slot='label'>Hinta</span><span slot='value'>426,30&nbsp;€ / vuosi</span></duet-list-item><duet-list-item><span slot='label'>Hakemus luotu</span><span slot='value'>22.1.2019</span></duet-list-item></duet-list></duet-grid-item><duet-grid-item margin='none'><duet-grid mobile='center'><duet-spacer breakpoint='medium' direction='horizontal' size='xxxx-large'></duet-spacer><duet-button tabindex='-1' wrapping='none' margin='none' variation='primary'>Valitse</duet-button></duet-grid><duet-spacer breakpoint='x-small' direction='vertical' size='large'></duet-spacer></duet-grid-item></duet-grid></duet-grid></duet-card><duet-card accessible-label='Pariturva-henkivakuutus, Anna Grönlund' url='#' padding='large'><duet-grid responsive distribution='space-between' alignment='top'><duet-grid alignment='center' responsive breakpoint='medium'><duet-grid-item fill><duet-heading level='h2' visual-level='h3'>Pariturva-henkivakuutus</duet-heading><duet-list padding='none' margin='none'><duet-list-item><span slot='label'>Hakemuksen luoja</span><span slot='value'>Anna Grönlund</span></duet-list-item><duet-list-item><span slot='label'>Vakuutusmäärä</span><span slot='value'>90&nbsp;000,00&nbsp;€</span></duet-list-item><duet-list-item><span slot='label'>Hinta</span><span slot='value'>822,40&nbsp;€ / vuosi</span></duet-list-item><duet-list-item><span slot='label'>Hakemus luotu</span><span slot='value'>6.2.2018</span></duet-list-item></duet-list></duet-grid-item><duet-grid-item margin='none'><duet-grid mobile='center'><duet-spacer breakpoint='medium' direction='horizontal' size='xxxx-large'></duet-spacer><duet-button tabindex='-1' wrapping='none' margin='none' variation='primary'>Valitse</duet-button></duet-grid><duet-spacer breakpoint='x-small' direction='vertical' size='large'></duet-spacer></duet-grid-item></duet-grid></duet-grid></duet-card>"
clone.querySelector("duet-card").classList.add("first")
aria.innerHTML = "Ladataan."
setTimeout(function() {
button.parentNode.removeChild(button)
load.innerHTML = clone.innerHTML
load.classList.add("active")

// Timeout to wait for the element to be visible first
setTimeout(function() {
document.querySelector(".first").setFocus()
aria.innerHTML = "Sivulle ladattiin lisää vakuutuksia."
}, 300)
}, 1000)
})
</script>
</body>
</html>

Integration

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

npm install @duetds/components
npm install @duetds/css
npm install @duetds/fonts

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

Tutorials

Usage With Markdown


Troubleshooting

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