kitbash Sign in Connect agent
Components

Item page

One piece: a double-width photo beside its bold name, price, a short paragraph, sizes as tiny ink squares and 'Add to bag.' as a bold word that counts.

Part of the style

Bare Serif Rack

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

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --ink: #d4fa01;
  --paper: #000000;
  --ink-muted: #64293e;
  --photo-ground: #000000;
}
</style>

<article class="item">
  <p class="item__crumbs"><a class="item__back" href="#">← back to the shelf</a> <i>Cone Six Tuesday — Small Pots</i></p>
  <div class="item__body">
    <img class="item__photo" src="assets/vine-vase.jpg" alt="White jar with blue brushed vines" width="634" height="800">
    <form class="item__info" action="#">
      <h1 class="item__name">Shoulder Jar Blue/White</h1>
      <p class="item__price">$62</p>
      <p class="item__copy">
        Thrown on a Sunday, trimmed on a Monday, fired on the Tuesday it is named after. Cobalt brushed by hand, so no two
        vines are the same. Holds a fistful of flowers or a week of wooden spoons.
      </p>
      <fieldset class="item__sizes">
        <legend class="item__legend">Size:</legend>
        <label class="item__size"><input class="item__radio" type="radio" name="item-size" value="S"><span class="item__box"></span> (S)</label>
        <label class="item__size"><input class="item__radio" type="radio" name="item-size" value="M" checked><span class="item__box"></span> (M)</label>
        <label class="item__size is-sold"><input class="item__radio" type="radio" name="item-size" value="L" disabled><span class="item__box"></span> <s>(L)</s> Sold</label>
      </fieldset>
      <p class="item__actions">
        <button class="item__add" type="submit">Add to bag.</button>
        <span class="item__bag" aria-live="polite">Your bag is empty.</span>
      </p>
      <p class="item__note">Ships in a shoebox full of newspaper. Every pot is one of one.</p>
    </form>
  </div>
</article>

<style>
  .item {
    padding: var(--edge) var(--edge) var(--section-space);
  }
  .item__crumbs {
    margin: 0 0 var(--section-space);
  }
  .item__back {
    padding-block: 10px;
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
  }
  .item__back:hover,
  .item__back:focus-visible {
    text-decoration: underline;
    text-decoration-thickness: var(--line);
  }
  .item__body {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--section-space) calc(var(--gap) * 2);
  }
  .item__photo {
    width: calc(var(--thumb) * 2 + var(--gap));
    height: auto;
    object-fit: contain;
    background: var(--photo-ground);
  }
  .item__info {
    flex: 1 1 18em;
    max-width: 30em;
    margin: 0;
  }
  .item__name,
  .item__price,
  .item__copy,
  .item__note,
  .item__actions {
    margin: 0 0 var(--leading);
    font-size: var(--text);
    font-weight: 400;
    line-height: var(--leading);
  }
  .item__name {
    margin: 0;
    font-weight: 700;
  }
  .item__note {
    margin: 0;
    color: var(--ink-muted);
  }
  .item__sizes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 var(--gap);
    margin: 0 0 var(--gap);
    padding: 0;
    border: 0;
  }
  .item__legend {
    float: left;
    padding: 0;
  }
  .item__size {
    display: inline-flex;
    align-items: center;
    min-width: 44px;
    min-height: 44px;
    gap: 4px;
    cursor: pointer;
  }
  .item__size:has(.item__radio:checked) {
    font-weight: 700;
  }
  .item__size.is-sold {
    color: var(--ink-muted);
    cursor: default;
  }
  /* The real radio covers the whole label, invisible; a small square of ink shows its state. */
  .item__size {
    position: relative;
  }
  .item__radio {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: inherit;
  }
  .item__box {
    width: 10px;
    height: 10px;
    border: var(--line) solid currentColor;
  }
  .item__radio:checked + .item__box {
    background: var(--ink);
  }
  .item__radio:focus-visible + .item__box {
    outline: var(--line) dotted var(--ink);
    outline-offset: 3px;
  }
  .item__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 var(--gap);
  }
  .item__add {
    min-height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    font: 700 var(--text)/var(--leading) var(--font-body);
    cursor: pointer;
  }
  .item__add:hover,
  .item__add:focus-visible {
    text-decoration: underline;
    text-decoration-thickness: var(--line);
  }
  .item__add:focus-visible {
    outline: var(--line) dotted var(--ink);
  }

  @media (max-width: 30rem) {
    .item__photo {
      width: 100%;
    }
  }
</style>

<script>
  (() => {
    document.querySelectorAll(".item").forEach((root) => {
      const form = root.querySelector(".item__info");
      const bag = root.querySelector(".item__bag");
      if (!form || !bag) return;
      let count = 0;
      form.addEventListener("submit", (event) => {
        event.preventDefault();
        count += 1;
        bag.textContent = count === 1 ? "1 thing in your bag." : count + " things in your bag.";
      });
    });
  })();
</script>

Similar components

At a glance

At a glance

Object page

Object page

Grey tile rail

Grey tile rail

Tabbed product shelf

Tabbed product shelf

Product grid

Product grid

Product page

Product page

Template shelf

Template shelf

Stamped pieces

Stamped pieces