kitbash Sign in Connect agent
Components

Table hero

A deck of white, cream and blue-grey cards in the middle of the green with the headline on the top card, coloured scraps flying in from the edges on load; the button deals the top card away.

Part of the style

Scattered Paper Cards

7 parts that belong together, with their tokens, type and rules.

Preview

Code
<style>
/* Goes after the pack's base.css */
@import url("https://fonts.googleapis.com/css2?family=Figtree:wght@400..900&display=swap");
:root {
  --font-display: "Figtree", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Figtree", "Helvetica Neue", Arial, sans-serif;
}
</style>

<section class="hero" aria-labelledby="hero-title">
  <div class="hero__scraps" aria-hidden="true">
    <span class="hero__scrap hero__scrap--sun"></span>
    <span class="hero__scrap hero__scrap--orange"></span>
    <span class="hero__scrap hero__scrap--lemon">
      <svg class="hero__tool" viewBox="0 0 60 140" fill="none" stroke-width="1.5" stroke-linecap="round">
        <path d="M30 4v46" />
        <path d="M30 50c-18 20-22 56-8 76 5 7 11 7 16 0 14-20 10-56-8-76z" />
        <path d="M30 50c-9 22-10 52-4 76M30 50c9 22 10 52 4 76M30 50c-14 18-18 48-12 70M30 50c14 18 18 48 12 70" />
      </svg>
    </span>
    <span class="hero__scrap hero__scrap--mint"></span>
    <span class="hero__scrap hero__scrap--red"></span>
    <span class="hero__scrap hero__scrap--white"></span>
  </div>

  <div class="hero__deck">
    <article class="hero__card hero__card--bright">
      <p class="hero__kicker">Card 1 of 4</p>
      <h1 class="hero__title" id="hero-title">Cook something loud today.</h1>
      <p class="hero__text">Recipe cards for small cooks: every step comes with a sound to make and a mess to allow.</p>
    </article>
    <article class="hero__card hero__card--shade" aria-hidden="true">
      <p class="hero__kicker">Card 2 of 4</p>
      <p class="hero__title">Crack, whisk, sizzle, done.</p>
      <p class="hero__text">Twenty-minute suppers with a drum part for whoever is not stirring.</p>
    </article>
    <article class="hero__card hero__card--blue" aria-hidden="true">
      <p class="hero__kicker">Card 3 of 4</p>
      <p class="hero__title">Flour on the ceiling is fine.</p>
      <p class="hero__text">Bakes that forgive a heavy hand and reward a loud one.</p>
    </article>
    <article class="hero__card hero__card--paper" aria-hidden="true">
      <p class="hero__kicker">Card 4 of 4</p>
      <p class="hero__title">Then wash up to a beat.</p>
      <p class="hero__text">The last card is always the sink. It has the best song.</p>
    </article>
  </div>

  <div class="hero__actions">
    <button class="hero__deal" type="button">Deal the next card</button>
    <a class="hero__link" href="#">See all 48 cards</a>
  </div>
</section>

<style>
  .hero {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: var(--space-xl);
    min-height: clamp(560px, 52vw, 720px);
    padding: var(--space-xl) var(--edge) var(--section-space);
    overflow: hidden;
    background: var(--field);
  }

  /* Scraps tossed around the edge, cropped by the section. */
  .hero__scraps { position: absolute; inset: 0; pointer-events: none; }
  .hero__scrap {
    position: absolute;
    display: block;
    width: var(--w);
    aspect-ratio: var(--ar, 3 / 4);
    clip-path: var(--quad-a);
    rotate: var(--r);
    animation: hero-fly var(--deal) var(--ease-pop) both;
    animation-delay: calc(var(--n) * 90ms);
  }
  .hero__scrap--sun { --w: clamp(120px, 16vw, 240px); --r: 28deg; --n: 0; --fx: -60vw; --fy: -20vw; left: -6%; top: -8%; background: var(--card-sun); }
  .hero__scrap--orange { --w: clamp(140px, 20vw, 300px); --ar: 4 / 3; --r: 2deg; --n: 1; --fx: 0; --fy: -40vw; left: 34%; top: -16%; background: var(--card-orange); clip-path: var(--quad-b); }
  .hero__scrap--lemon { --w: clamp(150px, 20vw, 290px); --ar: 4 / 3; --r: -12deg; --n: 2; --fx: 50vw; --fy: -30vw; right: -2%; top: -10%; background: var(--card-lemon); }
  .hero__scrap--mint { --w: clamp(80px, 9vw, 130px); --r: -10deg; --n: 3; --fx: 40vw; --fy: 0; right: -3%; top: 14%; background: var(--card-aqua); clip-path: var(--quad-c); z-index: -1; }
  .hero__scrap--red { --w: clamp(70px, 8vw, 120px); --ar: 1; --r: 38deg; --n: 4; --fx: 40vw; --fy: 10vw; right: -4%; top: 56%; background: var(--card-red); }
  .hero__scrap--white { --w: clamp(150px, 20vw, 300px); --ar: 3 / 2; --r: -16deg; --n: 5; --fx: -40vw; --fy: 40vw; left: 8%; bottom: -14%; background: var(--paper); clip-path: var(--quad-b); }
  .hero__tool {
    position: absolute;
    left: 28%;
    bottom: 6%;
    width: 22%;
    height: auto;
    stroke: var(--line-draw);
    rotate: 8deg;
  }
  @keyframes hero-fly {
    from { translate: var(--fx) var(--fy); rotate: calc(var(--r) + 50deg); }
    to { translate: 0 0; rotate: var(--r); }
  }

  /* The deck: every card takes the place its --pos gives it. */
  .hero__deck {
    position: relative;
    display: grid;
    width: min(460px, 100%);
  }
  .hero__card {
    --pos: 0;
    grid-area: 1 / 1;
    display: grid;
    align-content: start;
    gap: var(--space-m);
    min-height: 340px;
    padding: var(--space-xl) var(--space-l) var(--space-l);
    clip-path: var(--quad-a);
    z-index: calc(10 - var(--pos));
    transition: rotate var(--settle) var(--ease-pop), translate var(--settle) var(--ease-pop);
  }
  .hero__card[data-pos="0"] { rotate: -2deg; }
  .hero__card[data-pos="1"] { rotate: 5deg; translate: 14px 6px; clip-path: var(--quad-b); }
  .hero__card[data-pos="2"] { rotate: -8deg; translate: -16px 10px; clip-path: var(--quad-c); }
  .hero__card[data-pos="3"] { rotate: 9deg; translate: 10px 16px; }
  .hero__card[data-pos]:not([data-pos="0"]) > * { visibility: hidden; }
  .hero__card--bright { background: var(--paper-bright); }
  .hero__card--shade { background: var(--paper-shade); }
  .hero__card--blue { background: var(--paper-blue); }
  .hero__card--paper { background: var(--paper); }
  .hero__card.is-leaving { animation: hero-deal var(--deal) var(--ease) forwards; z-index: 11; }
  @keyframes hero-deal {
    40% { translate: 60% -8%; rotate: 14deg; }
    100% { translate: 0 18px; rotate: 9deg; z-index: 0; }
  }

  .hero__kicker {
    margin: 0;
    color: var(--ink-soft);
    font: 600 var(--text-xs)/1 var(--font-display);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .hero__title {
    margin: 0;
    font: 700 var(--display)/0.95 var(--font-display);
    letter-spacing: -0.02em;
    text-wrap: balance;
  }
  .hero__text { margin: 0; max-width: 32ch; font-size: var(--text-m); }

  .hero__actions {
    position: relative;
    z-index: 12;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: var(--space-l);
  }
  .hero__deal {
    min-height: 52px;
    padding: 0 var(--space-l);
    border: 0;
    border-radius: var(--pill);
    background: var(--ink);
    color: var(--paper-bright);
    font: 600 var(--text-m)/1 var(--font-display);
    cursor: pointer;
    transition: transform var(--settle) var(--ease-pop), background-color var(--quick) var(--ease);
  }
  .hero__deal:hover,
  .hero__deal:focus-visible { transform: rotate(-3deg) scale(1.04); outline: none; }
  .hero__deal:focus-visible { box-shadow: 0 0 0 var(--ring) var(--field), 0 0 0 calc(var(--ring) * 2) var(--on-field); }
  .hero__deal:active { transform: scale(0.96); }
  .hero__link {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    color: var(--on-field);
    font: 600 var(--text-m)/1 var(--font-display);
    text-underline-offset: 5px;
    text-decoration-thickness: var(--ring);
  }

  @media (max-width: 40rem) {
    .hero__card { min-height: 300px; padding: var(--space-l) var(--space-m) var(--space-m); }
    .hero__scrap--orange { left: 46%; }
  }
  @media (prefers-reduced-motion: reduce) {
    .hero__scrap { animation: none; }
    .hero__card.is-leaving { animation: none; }
  }
</style>

<script>
  (() => {
    const still = matchMedia('(prefers-reduced-motion: reduce)');
    for (const root of document.querySelectorAll('.hero')) {
      const deck = root.querySelector('.hero__deck');
      const button = root.querySelector('.hero__deal');
      if (!deck || !button) continue;
      let cards = [...deck.querySelectorAll('.hero__card')];
      const place = () => cards.forEach((card, i) => {
        card.dataset.pos = String(i);
        card.style.setProperty('--pos', i);
        card.setAttribute('aria-hidden', i === 0 ? 'false' : 'true');
      });
      place();
      let busy = false;
      button.addEventListener('click', () => {
        if (busy) return;
        const top = cards[0];
        const next = () => {
          top.classList.remove('is-leaving');
          cards = [...cards.slice(1), top];
          place();
          busy = false;
        };
        if (still.matches) return next();
        busy = true;
        top.classList.add('is-leaving');
        top.addEventListener('animationend', next, { once: true });
      });
    }
  })();
</script>

Similar components

Device hero

Device hero

Hero with card feed

Hero with card feed

Hero

Hero

Mark and standfirst

Mark and standfirst

Phone stage hero

Phone stage hero

Full-bleed arrival

Full-bleed arrival

Swinging badge hero

Swinging badge hero

Centred hero with foil word

Centred hero with foil word