kitbash Sign in Connect agent
Components

Place rail

Serif section title with round arrow buttons and an Explore more pill above a sideways rail of portrait photographs with translucent chips, grey meta and serif names; a heart saves a place and raises a toast.

Part of the style

Kraft Panel Split

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

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --ink: #000001;
  --ink-soft: #8e8c87;
  --paper: #fafafa;
  --paper-warm: #f3f3f3;
  --field: #e9e8e8;
  --stone: #cac9c7;
  --kraft-deep: #1f232b;
  --veil: rgba(0, 0, 1, 0.5);
  --veil-soft: rgba(0, 0, 1, 0.2);
  --paper-glass: rgba(250, 250, 250, 0.52);
  --night: #000002;
  --night-ink: #080b13;
  --line: rgba(0, 0, 1, 0.08);
  --kraft: #727793;
}
</style>

<section class="rail" aria-labelledby="rail-title">
  <div class="rail__head">
    <h2 class="rail__title" id="rail-title">Where to sit still in Lisbon</h2>
    <div class="rail__tools">
      <button class="rail__step" type="button" data-step="-1" aria-label="Previous">
        <svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M13 8H3m0 0 4-4M3 8l4 4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
      </button>
      <button class="rail__step" type="button" data-step="1" aria-label="Next">
        <svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M3 8h10m0 0-4-4m4 4-4 4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
      </button>
      <a class="rail__more" href="#">Explore more</a>
    </div>
  </div>

  <ul class="rail__track">
    <li class="rail__card">
      <a class="rail__pic" href="#">
        <img class="rail__img" src="assets/dining-room.jpg" alt="A long panelled dining room with a chandelier" width="800" height="547" loading="lazy">
        <span class="rail__chips"><span class="rail__chip">Long table</span><span class="rail__chip">Chandelier</span><span class="rail__chip">Quiet</span></span>
      </a>
      <button class="rail__save" type="button" aria-pressed="false" aria-label="Save Casa Verdelho">
        <svg viewBox="0 0 20 20" width="16" height="16" aria-hidden="true"><path d="M10 16.6s-6.2-3.8-6.2-8.1A3.4 3.4 0 0 1 10 6.6a3.4 3.4 0 0 1 6.2 1.9c0 4.3-6.2 8.1-6.2 8.1z" fill="currentColor" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/></svg>
      </button>
      <p class="rail__meta">Reading room<br>Lisbon, Portugal</p>
      <h3 class="rail__name">Casa Verdelho</h3>
    </li>
    <li class="rail__card">
      <a class="rail__pic" href="#">
        <img class="rail__img" src="assets/drawing-room.jpg" alt="A pale drawing room with columns and a bookcase" width="800" height="615" loading="lazy">
        <span class="rail__chips"><span class="rail__chip">Books</span><span class="rail__chip">Armchairs</span><span class="rail__chip">Tea</span></span>
      </a>
      <button class="rail__save" type="button" aria-pressed="false" aria-label="Save The Ledger Room">
        <svg viewBox="0 0 20 20" width="16" height="16" aria-hidden="true"><path d="M10 16.6s-6.2-3.8-6.2-8.1A3.4 3.4 0 0 1 10 6.6a3.4 3.4 0 0 1 6.2 1.9c0 4.3-6.2 8.1-6.2 8.1z" fill="currentColor" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/></svg>
      </button>
      <p class="rail__meta">Library<br>Lisbon, Portugal</p>
      <h3 class="rail__name">The Ledger Room</h3>
    </li>
    <li class="rail__card">
      <a class="rail__pic" href="#">
        <img class="rail__img" src="assets/sitting-room.jpg" alt="A sitting room with red curtains and a portrait" width="800" height="559" loading="lazy">
        <span class="rail__chips"><span class="rail__chip">Portraits</span><span class="rail__chip">Garden view</span></span>
      </a>
      <button class="rail__save" type="button" aria-pressed="false" aria-label="Save Salão Pimenta">
        <svg viewBox="0 0 20 20" width="16" height="16" aria-hidden="true"><path d="M10 16.6s-6.2-3.8-6.2-8.1A3.4 3.4 0 0 1 10 6.6a3.4 3.4 0 0 1 6.2 1.9c0 4.3-6.2 8.1-6.2 8.1z" fill="currentColor" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/></svg>
      </button>
      <p class="rail__meta">House museum<br>Sintra, Portugal</p>
      <h3 class="rail__name">Salão Pimenta</h3>
    </li>
    <li class="rail__card">
      <a class="rail__pic" href="#">
        <img class="rail__img" src="assets/entrance-hall.jpg" alt="A hall with a curving staircase and painted walls" width="800" height="772" loading="lazy">
        <span class="rail__chips"><span class="rail__chip">Murals</span><span class="rail__chip">Stairs</span></span>
      </a>
      <button class="rail__save" type="button" aria-pressed="false" aria-label="Save Hall of Small Hours">
        <svg viewBox="0 0 20 20" width="16" height="16" aria-hidden="true"><path d="M10 16.6s-6.2-3.8-6.2-8.1A3.4 3.4 0 0 1 10 6.6a3.4 3.4 0 0 1 6.2 1.9c0 4.3-6.2 8.1-6.2 8.1z" fill="currentColor" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/></svg>
      </button>
      <p class="rail__meta">Gallery<br>Lisbon, Portugal</p>
      <h3 class="rail__name">Hall of Small Hours</h3>
    </li>
    <li class="rail__card">
      <a class="rail__pic" href="#">
        <img class="rail__img" src="assets/shaker-room.jpg" alt="A plain wooden room with pegs on the wall" width="1200" height="559" loading="lazy">
        <span class="rail__chips"><span class="rail__chip">Plain wood</span><span class="rail__chip">Workshop</span></span>
      </a>
      <button class="rail__save" type="button" aria-pressed="false" aria-label="Save Oficina Baixa">
        <svg viewBox="0 0 20 20" width="16" height="16" aria-hidden="true"><path d="M10 16.6s-6.2-3.8-6.2-8.1A3.4 3.4 0 0 1 10 6.6a3.4 3.4 0 0 1 6.2 1.9c0 4.3-6.2 8.1-6.2 8.1z" fill="currentColor" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/></svg>
      </button>
      <p class="rail__meta">Craft room<br>Porto, Portugal</p>
      <h3 class="rail__name">Oficina Baixa</h3>
    </li>
  </ul>

  <p class="rail__toast" role="status" aria-live="polite"></p>
</section>

<style>
  .rail {
    position: relative;
    padding: var(--section-space) 0;
    overflow: hidden;
  }
  .rail__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-m);
    padding: 0 var(--edge);
    margin-bottom: var(--space-l);
  }
  .rail__title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: var(--text-l);
    font-weight: 400;
    line-height: 1.2;
  }
  .rail__tools {
    display: flex;
    align-items: center;
    flex: none;
  }
  .rail__step {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    cursor: pointer;
  }
  .rail__step svg {
    box-sizing: content-box;
    padding: 10px;
    border-radius: var(--pill);
    background: var(--field);
    transition: background var(--quick) var(--ease), color var(--quick) var(--ease);
  }
  .rail__step:hover svg { background: var(--stone); }
  .rail__step:disabled { cursor: default; color: var(--ink-soft); }
  .rail__step:disabled svg { background: var(--paper-warm); }
  .rail__more {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-left: var(--space-xs);
    padding: 0 14px;
    border-radius: var(--pill);
    background: var(--field);
    color: var(--ink);
    font-size: var(--text-s);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--quick) var(--ease);
  }
  .rail__more:hover { background: var(--stone); }
  .rail button:focus-visible,
  .rail a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

  .rail__track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: clamp(150px, 22vw, 300px);
    gap: var(--gap);
    margin: 0;
    padding: 0 var(--edge);
    list-style: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--edge);
    scrollbar-width: none;
  }
  .rail__track::-webkit-scrollbar { display: none; }
  .rail__card {
    position: relative;
    scroll-snap-align: start;
  }
  .rail__pic {
    position: relative;
    display: block;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: var(--radius-s);
    background: var(--paper-warm);
  }
  .rail__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 600ms var(--ease);
  }
  .rail__pic:hover .rail__img,
  .rail__pic:focus-visible .rail__img { transform: scale(1.03); }
  .rail__chips {
    position: absolute;
    left: var(--space-s);
    right: var(--space-s);
    bottom: var(--space-s);
    display: flex;
    gap: 2px;
    overflow: hidden;
  }
  .rail__chip {
    flex: none;
    padding: 6px 10px;
    border-radius: var(--radius-s);
    background: var(--veil);
    backdrop-filter: blur(8px);
    color: var(--paper);
    font-size: var(--text-xs);
    line-height: 1;
  }
  .rail__save {
    position: absolute;
    top: var(--space-xs);
    right: var(--space-xs);
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: var(--pill);
    background: none;
    color: transparent;
    cursor: pointer;
  }
  .rail__save svg {
    box-sizing: content-box;
    padding: 6px;
    border-radius: var(--pill);
    background: var(--veil);
    backdrop-filter: blur(8px);
    stroke: var(--paper);
    transition: transform 180ms var(--spring), color var(--quick) var(--ease);
  }
  .rail__save:hover svg { transform: scale(1.1); }
  .rail__save.is-saved { color: var(--paper); }
  .rail__save.is-saved svg { stroke: var(--paper); animation: rail-pop 320ms var(--spring); }
  @keyframes rail-pop {
    0% { transform: scale(0.6); }
    100% { transform: scale(1); }
  }
  .rail__meta {
    margin: var(--space-m) 0 var(--space-s);
    color: var(--ink-soft);
    font-size: var(--text-s);
    line-height: 1.2;
  }
  .rail__name {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 400;
    line-height: 1.2;
  }

  .rail__toast {
    position: absolute;
    left: 50%;
    bottom: var(--space-l);
    margin: 0;
    padding: 12px 18px;
    border-radius: var(--pill);
    background: var(--ink);
    color: var(--paper);
    font-size: var(--text-s);
    white-space: nowrap;
    box-shadow: var(--shadow-pop);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 16px);
    transition: opacity var(--quick) var(--ease), transform 180ms var(--spring);
  }
  .rail__toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

  @media (max-width: 56rem) {
    .rail__track { grid-auto-columns: minmax(150px, 40vw); gap: var(--space-m); }
    .rail__step { display: none; }
  }
</style>

<script>
  (() => {
    for (const root of document.querySelectorAll('.rail')) {
      const track = root.querySelector('.rail__track');
      const steps = root.querySelectorAll('.rail__step');
      const toast = root.querySelector('.rail__toast');
      let hide = 0;
      const update = () => {
        const end = track.scrollWidth - track.clientWidth - 2;
        steps.forEach((step) => {
          step.disabled = Number(step.dataset.step) < 0 ? track.scrollLeft <= 2 : track.scrollLeft >= end;
        });
      };
      steps.forEach((step) => step.addEventListener('click', () => {
        const card = track.querySelector('.rail__card');
        const by = card ? card.getBoundingClientRect().width + parseFloat(getComputedStyle(track).columnGap || 0) : 300;
        track.scrollBy({ left: by * Number(step.dataset.step), behavior: 'smooth' });
      }));
      track.addEventListener('scroll', update, { passive: true });
      update();
      root.querySelectorAll('.rail__save').forEach((save) => save.addEventListener('click', () => {
        const on = !save.classList.contains('is-saved');
        save.classList.toggle('is-saved', on);
        save.setAttribute('aria-pressed', String(on));
        const name = save.closest('.rail__card').querySelector('.rail__name').textContent;
        toast.textContent = (on ? 'Saved ' : 'Removed ') + name;
        toast.classList.add('is-shown');
        clearTimeout(hide);
        hide = setTimeout(() => toast.classList.remove('is-shown'), 2400);
      }));
    }
  })();
</script>

Similar components

Numbered tile index

Numbered tile index

Project cards

Project cards

Grey print tiles

Grey print tiles

Tinted plates

Tinted plates

Staggered work grid

Staggered work grid

Event board

Event board

Project cards

Project cards

Mascot signboard

Mascot signboard