kitbash Sign in Connect agent
Components

Floating dock

Wordmark at left, a white pill dock in the centre with two crayon-icon items, and a round mail button; Ask opens the pill into a question field.

Part of the style

Crayon Sketch Serif

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

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --ink: #c5c4c9;
  --ink-soft: rgba(198, 197, 202, 0.58);
  --ink-faint: rgba(198, 197, 202, 0.12);
  --paper: #030303;
  --paper-cool: #040404;
  --on-badge: #030303;
  --crayon-grey: #6a696c;
  --crayon-red: #3f498f;
  --crayon-blue: #454b7a;
  --badge: #6c76cf;
  --crayon-green: #3f498f;
  --crayon-yellow: #454b7a;
  --crayon-tan: #4b5069;
  --crayon-violet: #3f498f;
}
</style>

<header class="dock">
  <a class="dock__brand" href="#" aria-label="Bramble Office, home">
    <svg class="dock__sprig" viewBox="0 0 28 28" aria-hidden="true">
      <path d="M5 23 C 11 17, 15 12, 22 5" fill="none" stroke="var(--crayon-green)" stroke-width="1.8" stroke-linecap="round"/>
      <path d="M11 17 C 8 14, 8 11, 10 9 C 12 12, 12 15, 11 17 Z" fill="none" stroke="var(--crayon-green)" stroke-width="1.4" stroke-linejoin="round"/>
      <path d="M16 11 C 18 8, 21 8, 23 10 C 20 12, 18 12, 16 11 Z" fill="none" stroke="var(--crayon-green)" stroke-width="1.4" stroke-linejoin="round"/>
      <circle cx="21" cy="17" r="2.2" fill="var(--crayon-red)" opacity="0.85"/>
      <circle cx="17.5" cy="20" r="1.8" fill="var(--crayon-violet)" opacity="0.85"/>
    </svg>
    <span class="dock__wordmark">Bramble Office</span>
  </a>

  <nav class="dock__pill" aria-label="Main">
    <a class="dock__item" href="#">
      <svg class="dock__icon" viewBox="0 0 20 20" aria-hidden="true">
        <circle cx="8.5" cy="8.5" r="5.5" fill="none" stroke="var(--crayon-blue)" stroke-width="1.6"/>
        <path d="M12.6 12.6 L17 17" stroke="var(--crayon-red)" stroke-width="1.8" stroke-linecap="round"/>
      </svg>
      <span>Explore</span>
    </a>
    <button class="dock__item dock__ask" type="button" aria-expanded="false">
      <svg class="dock__icon" viewBox="0 0 22 20" aria-hidden="true">
        <path d="M4 13 A7 7 0 0 1 18 13 Z" fill="var(--crayon-yellow)"/>
        <path d="M2 15.5 C 6 14, 9 17, 13 15.5 S 18 15, 20.5 16" fill="none" stroke="var(--crayon-blue)" stroke-width="1.3" stroke-linecap="round"/>
        <path d="M5 18 C 9 16.8, 12 19, 17 17.6" fill="none" stroke="var(--crayon-green)" stroke-width="1.2" stroke-linecap="round"/>
      </svg>
      <span>Ask</span>
    </button>
    <form class="dock__field" action="#" role="search">
      <label class="dock__label" for="dock-question">Ask a question</label>
      <input class="dock__input" id="dock-question" type="text" placeholder="What did you make for small farms?" tabindex="-1">
      <button class="dock__send" type="submit" aria-label="Send question" tabindex="-1">
        <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M4 10 H15 M10.5 5.5 L15 10 L10.5 14.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>
      </button>
    </form>
  </nav>

  <a class="dock__mail" href="#" aria-label="Write to us">
    <svg viewBox="0 0 22 22" aria-hidden="true">
      <rect x="3" y="5" width="16" height="12" rx="2.5" fill="none" stroke="currentColor" stroke-width="1.5"/>
      <path d="M4 7 L11 12 L18 7" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/>
    </svg>
  </a>
</header>

<style>
  .dock {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--space-s);
    padding: 16px var(--edge);
    font-family: var(--font-display);
    color: var(--ink);
  }
  .dock__brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    justify-self: start;
    color: inherit;
    text-decoration: none;
  }
  .dock__sprig { width: 28px; height: 28px; flex: none; }
  .dock__wordmark {
    font-size: 22px;
    font-style: italic;
    letter-spacing: -0.01em;
    white-space: nowrap;
  }

  .dock__pill {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    width: 220px;
    height: 48px;
    padding: 0 6px;
    background: var(--paper);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition: width var(--slow) var(--ease), box-shadow var(--slow) var(--ease);
  }
  .dock__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 14px;
    border: 0;
    background: none;
    border-radius: var(--radius-pill);
    color: var(--ink);
    font: 400 var(--text-m)/1 var(--font-display);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: color var(--quick) var(--ease), opacity var(--slow) var(--ease), background-color var(--quick) var(--ease);
  }
  .dock__item:hover,
  .dock__item:focus-visible { color: var(--ink-soft); }
  .dock__item:focus-visible,
  .dock__mail:focus-visible,
  .dock__brand:focus-visible,
  .dock__send:focus-visible { outline: var(--rule) solid var(--ink); outline-offset: 2px; }
  .dock__icon { width: 20px; height: 20px; flex: none; transition: transform var(--slow) var(--ease); }
  .dock__item:hover .dock__icon { transform: translateY(-2px) rotate(-6deg); }

  .dock__field {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 6px 0 20px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--slow) var(--ease);
  }
  .dock__label {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .dock__input {
    flex: 1;
    min-width: 0;
    height: 44px;
    border: 0;
    background: none;
    color: var(--ink);
    font: 400 var(--text-m)/1 var(--font-display);
    outline: none;
  }
  .dock__input::placeholder { color: var(--ink-soft); }
  .dock__send {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: none;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--ink);
    color: var(--paper);
    cursor: pointer;
  }
  .dock__send svg { width: 18px; height: 18px; }

  .dock.is-asking .dock__pill { width: min(440px, 100%); box-shadow: var(--shadow-lift); }
  .dock.is-asking .dock__item { opacity: 0; pointer-events: none; }
  .dock.is-asking .dock__field { opacity: 1; pointer-events: auto; transition-delay: 120ms; }

  .dock__mail {
    justify-self: end;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-pill);
    background: var(--paper);
    box-shadow: var(--shadow-soft);
    color: var(--ink);
    transition: box-shadow var(--slow) var(--ease);
  }
  .dock__mail:hover { box-shadow: var(--shadow-lift); }
  .dock__mail svg { width: 22px; height: 22px; }

  @media (max-width: 640px) {
    .dock { grid-template-columns: 1fr auto; row-gap: 10px; }
    .dock__pill { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
    .dock__mail { grid-column: 2; grid-row: 1; }
    .dock.is-asking .dock__pill { width: 100%; }
  }
</style>

<script>
(() => {
  for (const root of document.querySelectorAll('.dock')) {
    const ask = root.querySelector('.dock__ask');
    const input = root.querySelector('.dock__input');
    const send = root.querySelector('.dock__send');
    const form = root.querySelector('.dock__field');
    const set = (open) => {
      root.classList.toggle('is-asking', open);
      ask.setAttribute('aria-expanded', String(open));
      input.tabIndex = open ? 0 : -1;
      send.tabIndex = open ? 0 : -1;
      if (open) setTimeout(() => input.focus(), 200);
    };
    ask.addEventListener('click', () => set(true));
    form.addEventListener('submit', (event) => { event.preventDefault(); input.value = ''; set(false); ask.focus(); });
    root.addEventListener('keydown', (event) => { if (event.key === 'Escape' && root.classList.contains('is-asking')) { set(false); ask.focus(); } });
    root.addEventListener('focusout', (event) => {
      if (root.classList.contains('is-asking') && !root.querySelector('.dock__pill').contains(event.relatedTarget) && !input.value) set(false);
    });
  }
})();
</script>

Similar components

Readout bar

Readout bar

Three-word bar

Three-word bar

Floating pill bar

Floating pill bar

Control sheet

Control sheet

Top bar

Top bar

Ruler bar and pill nav

Ruler bar and pill nav

Floating bar

Floating bar

Pill menu bar

Pill menu bar