kitbash Sign in Connect agent
Components

Dark picture hero

Crossfading full-bleed pictures under a dark veil, a large tight headline bottom-left and a white field with a black button.

Part of the style

Swatch Tile Console

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

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --ink: #5e352b;
  --paper: #d5e8e6;
  --mist: #cadfdd;
  --graphite: #7e584f;
  --smoke: #78574e;
  --ink-soft: #83a7a4;
  --ink-faint: #9dbab7;
  --line: #bdd4d2;
  --line-on-field: rgba(213, 232, 230, 0.28);
  --scrim: rgba(94, 53, 43, 0.62);
  --scrim-soft: rgba(94, 53, 43, 0.22);
  --swatch-blue: #c7a898;
  --swatch-violet: #cba998;
  --field: #d0a284;
  --field-deep: #b68f76;
  --swatch-lime: #c7a898;
  --swatch-red: #d0a284;
}
</style>

<section class="hero" aria-label="Introduction">
  <div class="hero__frames">
    <figure class="hero__frame is-active">
      <figcaption class="hero__caption">Saltmarsh Rowing Club</figcaption>
      <img class="hero__picture" src="assets/boats-rest.jpg" alt="Two rowing boats pulled up on a grassy bank by a creek" width="1200" height="870" />
    </figure>
    <figure class="hero__frame">
      <figcaption class="hero__caption">Low Tide Charter</figcaption>
      <img class="hero__picture" src="assets/nocturne.jpg" alt="Harbour water at dusk, a low moon over a far shore" width="1200" height="793" />
    </figure>
  </div>
  <div class="hero__veil" aria-hidden="true"></div>

  <div class="hero__body">
    <h1 class="hero__title">Boats that float, and keep floating.</h1>
    <p class="hero__lead">We haul out, rebuild and launch your boat, then show your crew what to check every month on the water.</p>
    <form class="hero__form" action="#" onsubmit="return false">
      <label class="hero__label" for="hero-hull">Your hull number</label>
      <input class="hero__input" id="hero-hull" name="hull" type="text" placeholder="Paste your hull number" autocomplete="off" />
      <button class="hero__button" type="submit">
        <span>Check my boat for free</span>
        <svg viewBox="0 0 12 12" width="12" height="12" aria-hidden="true"><path d="M3 9 9 3M4 3h5v5" fill="none" stroke="currentColor" stroke-width="1.3" /></svg>
      </button>
    </form>
    <p class="hero__note">About a minute. No call needed.</p>
  </div>

  <a class="hero__tag" href="#">
    <span class="hero__tag-label">Our work</span>
    <span class="hero__tag-name">Saltmarsh Rowing Club</span>
  </a>
</section>

<style>
  .hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: clamp(600px, 56vw, 860px);
    padding: 120px var(--edge) clamp(24px, 3vw, 44px);
    overflow: hidden;
    background: var(--ink);
    color: var(--paper);
  }
  .hero__frames,
  .hero__frame,
  .hero__veil {
    position: absolute;
    inset: 0;
    margin: 0;
  }
  .hero__frame {
    opacity: 0;
    transition: opacity var(--slow) var(--ease);
  }
  .hero__frame.is-active {
    opacity: 1;
  }
  .hero__picture {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.06);
    transition: transform calc(var(--hold) + var(--slow)) linear;
  }
  .hero__frame.is-active .hero__picture {
    transform: scale(1);
  }
  .hero__caption {
    display: none;
  }
  .hero__veil {
    background: linear-gradient(transparent 25%, var(--scrim) 80%), var(--scrim-soft);
  }

  .hero__body {
    position: relative;
    width: min(100%, 640px);
  }
  .hero__title {
    margin: 0;
    font-family: var(--font-display);
    font-size: var(--display-l);
    font-weight: 400;
    line-height: 0.98;
    letter-spacing: var(--track-display);
    text-wrap: balance;
  }
  .hero__lead {
    max-width: 30em;
    margin: var(--space-m) 0 var(--space-l);
    font-size: var(--text-m);
    line-height: 1.32;
  }
  .hero__form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-xs);
    padding: var(--space-xs);
    border-radius: var(--radius);
    background: var(--paper);
  }
  .hero__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .hero__input {
    min-width: 0;
    min-height: var(--control);
    padding: 0 12px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: var(--text-s);
  }
  .hero__input::placeholder {
    color: var(--ink-soft);
  }
  .hero__input:focus-visible {
    outline: 2px solid var(--swatch-blue);
  }
  .hero__button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-l);
    min-height: var(--control);
    padding: 0 16px;
    border: 0;
    border-radius: var(--radius);
    background: var(--ink);
    color: var(--paper);
    font: inherit;
    font-size: var(--text-s);
    cursor: pointer;
    transition: background-color var(--quick) var(--ease);
  }
  .hero__button:hover,
  .hero__button:focus-visible {
    background: var(--smoke);
  }
  .hero__note {
    margin: var(--space-s) 0 0;
    font-size: var(--text-xs);
    opacity: 0.85;
  }

  .hero__tag {
    position: absolute;
    right: var(--edge);
    bottom: clamp(24px, 3vw, 44px);
    display: grid;
    justify-items: end;
    gap: 6px;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--paper);
    font-size: var(--text-xs);
    text-decoration: none;
    background:
      linear-gradient(currentColor, currentColor) left top / 1px 7px no-repeat,
      linear-gradient(currentColor, currentColor) right top / 1px 7px no-repeat,
      linear-gradient(currentColor, currentColor) left bottom / 1px 7px no-repeat,
      linear-gradient(currentColor, currentColor) right bottom / 1px 7px no-repeat;
  }
  .hero__tag-label {
    opacity: 0.85;
  }
  .hero__tag-name {
    font-size: var(--text-s);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: opacity var(--quick) var(--ease);
  }
  .hero__tag.is-swapping .hero__tag-name {
    opacity: 0;
  }

  @media (max-width: 720px) {
    .hero {
      min-height: 640px;
      align-items: flex-end;
    }
    .hero__form {
      grid-template-columns: 1fr;
      padding: 0;
      background: none;
      gap: var(--space-s);
    }
    .hero__input {
      background: var(--paper);
    }
  }
  @media (max-width: 960px) {
    .hero__tag {
      top: 84px;
      bottom: auto;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .hero__picture,
    .hero__frame.is-active .hero__picture {
      transform: none;
      transition: none;
    }
  }
</style>

<script>
  (() => {
    const still = window.matchMedia('(prefers-reduced-motion: reduce)');
    for (const root of document.querySelectorAll('.hero')) {
      const frames = [...root.querySelectorAll('.hero__frame')];
      const tag = root.querySelector('.hero__tag');
      const name = root.querySelector('.hero__tag-name');
      if (frames.length < 2) continue;
      const hold = parseFloat(getComputedStyle(root).getPropertyValue('--hold')) || 6000;
      let index = 0;
      let timer = 0;
      let visible = false;

      const step = () => {
        frames[index].classList.remove('is-active');
        index = (index + 1) % frames.length;
        frames[index].classList.add('is-active');
        if (tag && name) {
          tag.classList.add('is-swapping');
          setTimeout(() => {
            name.textContent = frames[index].querySelector('.hero__caption')?.textContent || '';
            tag.classList.remove('is-swapping');
          }, 300);
        }
      };
      const run = () => {
        clearInterval(timer);
        timer = 0;
        if (visible && !still.matches && !document.hidden) timer = setInterval(step, hold);
      };

      new IntersectionObserver((entries) => {
        visible = entries[0].isIntersecting;
        run();
      }).observe(root);
      document.addEventListener('visibilitychange', run);
      still.addEventListener('change', run);
    }
  })();
</script>

Similar components

Prompt hero

Prompt hero

Dot-mosaic hero

Dot-mosaic hero

Spread headline

Spread headline

Hello column

Hello column

Glass word with falling stickers

Glass word with falling stickers

Sketch statement

Sketch statement

Backlit silhouette

Backlit silhouette

Huge line over a photograph

Huge line over a photograph