kitbash Sign in Connect agent
Components

Corner nav

Three tiny caps labels in the corners: name, version, index and lab. Each link scrambles on hover.

Part of the style

Teal Haze Lab

6 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=Inter:opsz,wght@14..32,400..700&family=Fraunces:ital,opsz,wght@1,9..144,400..600&display=swap");
:root {
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", "Helvetica Neue", Arial, sans-serif;
}
</style>

<header class="nav">
  <a class="nav__link nav__brand" href="#" data-scramble>Halloway Signal</a>
  <span class="nav__version">Workbook v07</span>
  <nav class="nav__menu" aria-label="Main">
    <a class="nav__link" href="#" data-scramble>__Index</a>
    <a class="nav__link" href="#" data-scramble>The Lab</a>
  </nav>
</header>

<style>
  .nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr);
    align-items: start;
    gap: var(--gap);
    padding: calc(var(--edge) - 13px) var(--edge) 0;
    position: relative;
    z-index: 2;
    color: var(--ink);
  }
  .nav__link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    text-decoration: none;
    white-space: nowrap;
  }
  .nav__brand {
    justify-self: start;
  }
  .nav__version {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: var(--tap);
  }
  .nav__menu {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-l);
  }
  .nav__link:focus-visible {
    outline: var(--rule) solid var(--ink);
    outline-offset: 2px;
  }

  @media (max-width: 40rem) {
    .nav {
      grid-template-columns: minmax(0, 1fr) auto;
    }
    .nav__version {
      display: none;
    }
    .nav__menu {
      gap: var(--space-m);
    }
  }
</style>

<script>
  (() => {
    const glyphs = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_/#%';
    const still = matchMedia('(prefers-reduced-motion: reduce)');
    const stepOf = (element) => parseFloat(getComputedStyle(element).getPropertyValue('--scramble-step')) || 34;

    function scramble(link) {
      const text = link.dataset.text;
      let step = 0;
      clearInterval(link.scrambleTimer);
      link.scrambleTimer = setInterval(() => {
        const settled = Math.floor(step / 1.6);
        link.textContent = [...text].map((letter, index) =>
          index < settled || letter === ' ' ? letter : glyphs[Math.floor(Math.random() * glyphs.length)]
        ).join('');
        step += 1;
        if (settled >= text.length) {
          clearInterval(link.scrambleTimer);
          link.textContent = text;
        }
      }, stepOf(link));
    }

    document.querySelectorAll('.nav').forEach((nav) => {
      nav.querySelectorAll('[data-scramble]').forEach((link) => {
        link.dataset.text = link.textContent;
        link.setAttribute('aria-label', link.textContent);
        const start = () => { if (!still.matches) scramble(link); };
        link.addEventListener('pointerenter', start);
        link.addEventListener('focus', start);
      });
    });
  })();
</script>

Similar components

Corner masthead

Corner masthead

Bottom bar

Bottom bar

Wordmark masthead

Wordmark masthead

Corner nav with stepped panels

Corner nav with stepped panels

Grid masthead

Grid masthead

Masthead and profile

Masthead and profile

Masthead

Masthead

Top bar

Top bar