E-commerce

E-commerce blocks cover product display, pricing, variant selection, cart management, and checkout summaries. They compose with content and action blocks to build complete shopping experiences.

Price

Formatted price display with tabular numerals. Supports sale pricing with original/discount, currency symbols, and subscription periods.

Default price

index.htmlhtml
<span class="ln-price">
  <span class="ln-price__currency">$</span>
  <span class="ln-price__current">49.99</span>
</span>
$49.99

Sale price

index.htmlhtml
<span class="ln-price ln-price--sale">
  <span class="ln-price__currency">$</span>
  <span class="ln-price__current">29.99</span>
  <span class="ln-price__original">$49.99</span>
  <span class="ln-price__discount">-40%</span>
</span>
$29.99$49.99-40%

Rating

Star rating display with optional numeric value and review count. Set --rating (0–5) on the stars element to control fill level. Override --star-color to change the fill color.

Default rating

index.htmlhtml
<div class="ln-rating">
  <div class="ln-rating__stars" style="--rating: 4"></div>
  <span class="ln-rating__value">4.0</span>
  <span class="ln-rating__count">(128 reviews)</span>
</div>
4.0(128 reviews)

Custom color

index.htmlhtml
<div class="ln-rating">
  <div class="ln-rating__stars" style="--rating: 3.5; --star-color: var(--warning-text)"></div>
  <span class="ln-rating__value">3.5</span>
  <span class="ln-rating__count">(42 reviews)</span>
</div>
3.5(42 reviews)

Swatch

Variant selectors for color, text, and image options. Uses visually hidden radio/checkbox inputs with custom styled labels. Set the --c custom property to control each option’s color.

Color swatches

index.htmlhtml
<div class="ln-swatch">
  <label class="ln-swatch__option">
    <input class="ln-swatch__input" type="radio" name="color" value="black" checked>
    <span class="ln-swatch__color" style="--c: #000"></span>
  </label>
  <label class="ln-swatch__option">
    <input class="ln-swatch__input" type="radio" name="color" value="white">
    <span class="ln-swatch__color" style="--c: #fff"></span>
  </label>
  <label class="ln-swatch__option">
    <input class="ln-swatch__input" type="radio" name="color" value="blue">
    <span class="ln-swatch__color" style="--c: #3b82f6"></span>
  </label>
  <label class="ln-swatch__option">
    <input class="ln-swatch__input" type="radio" name="color" value="red">
    <span class="ln-swatch__color" style="--c: #ef4444"></span>
  </label>
</div>

Text swatches

index.htmlhtml
<div class="ln-swatch ln-swatch--text">
  <label class="ln-swatch__option">
    <input class="ln-swatch__input" type="radio" name="size" value="s" checked>
    <span class="ln-swatch__color">S</span>
  </label>
  <label class="ln-swatch__option">
    <input class="ln-swatch__input" type="radio" name="size" value="m">
    <span class="ln-swatch__color">M</span>
  </label>
  <label class="ln-swatch__option">
    <input class="ln-swatch__input" type="radio" name="size" value="l">
    <span class="ln-swatch__color">L</span>
  </label>
  <label class="ln-swatch__option">
    <input class="ln-swatch__input" type="radio" name="size" value="xl">
    <span class="ln-swatch__color">XL</span>
  </label>
</div>

Text swatches with custom colors

index.htmlhtml
<div class="ln-swatch ln-swatch--text">
  <label class="ln-swatch__option">
    <input class="ln-swatch__input" type="radio" name="plan" value="basic" checked>
    <span class="ln-swatch__color" style="--c: #22c55e">Basic</span>
  </label>
  <label class="ln-swatch__option">
    <input class="ln-swatch__input" type="radio" name="plan" value="pro">
    <span class="ln-swatch__color" style="--c: #a855f7">Pro</span>
  </label>
  <label class="ln-swatch__option">
    <input class="ln-swatch__input" type="radio" name="plan" value="enterprise">
    <span class="ln-swatch__color" style="--c: #f97316">Enterprise</span>
  </label>
</div>

Quantity

Increment/decrement input for cart quantities. Add data-ln-quantity to wire up the buttons automatically. Respects min, max, and step attributes on the input.

Default quantity

index.htmlhtml
<div class="ln-quantity" data-ln-quantity>
  <button class="ln-quantity__decrement" type="button">−</button>
  <input class="ln-quantity__input" type="number" value="1" min="1" max="10">
  <button class="ln-quantity__increment" type="button">+</button>
</div>

Gallery

Image gallery with scroll-snap slides, thumbnail strip, and dot indicators. Add data-ln-gallery to sync thumbnail selection with the visible slide.

Gallery with thumbnails

index.htmlhtml
<div class="ln-gallery" data-ln-gallery>
  <div class="ln-gallery__main">
    <div class="ln-gallery__slide">
      <img src="/placeholder-1.svg" alt="Product view 1">
    </div>
    <div class="ln-gallery__slide">
      <img src="/placeholder-2.svg" alt="Product view 2">
    </div>
    <div class="ln-gallery__slide">
      <img src="/placeholder-3.svg" alt="Product view 3">
    </div>
  </div>
  <div class="ln-gallery__thumbs">
    <button class="ln-gallery__thumb is-active" aria-selected="true">
      <img src="/placeholder-1.svg" alt="Thumb 1">
    </button>
    <button class="ln-gallery__thumb" aria-selected="false">
      <img src="/placeholder-2.svg" alt="Thumb 2">
    </button>
    <button class="ln-gallery__thumb" aria-selected="false">
      <img src="/placeholder-3.svg" alt="Thumb 3">
    </button>
  </div>
</div>

Product Card

Commerce-ready card with media area, vendor label, title, price, and actions. Supports aspect ratio modifiers, badges, and sold-out state.

Default product card

index.htmlhtml
<div class="ln-product-card">
  <div class="ln-product-card__media">
    <div class="ln-product-card__img">
      <div class="docs-placeholder docs-placeholder--fill"></div>
    </div>
  </div>
  <div class="ln-product-card__body">
    <span class="ln-product-card__vendor">Acme Co</span>
    <h3 class="ln-product-card__title">Classic T-Shirt</h3>
    <span class="ln-price">
      <span class="ln-price__currency">$</span>
      <span class="ln-price__current">29.00</span>
    </span>
  </div>
  <div class="ln-product-card__actions">
    <button class="ln-button ln-button--solid ln-button--block">Add to cart</button>
  </div>
</div>
Acme Co

Classic T-Shirt

$29.00

Line Item

Cart or order row with image thumbnail, product details, price, and remove button. Uses a 3-column grid: 4rem 1fr auto. Group multiple items for a cart list — borders separate them automatically.

Default line item

index.htmlhtml
<div class="ln-line-item">
  <div class="ln-line-item__media">
    <div class="docs-placeholder docs-placeholder--fill"></div>
  </div>
  <div class="ln-line-item__body">
    <div class="ln-line-item__title">Classic T-Shirt</div>
    <div class="ln-line-item__meta">Black / M</div>
  </div>
  <div class="ln-line-item__side">
    <div class="ln-line-item__price">$58.00</div>
    <button class="ln-line-item__remove" type="button" aria-label="Remove">&times;</button>
  </div>
</div>
Classic T-Shirt
Black / M
$58.00

Multiple line items

index.htmlhtml
<div>
  <div class="ln-line-item">
    <div class="ln-line-item__media">
      <div class="docs-placeholder docs-placeholder--fill"></div>
    </div>
    <div class="ln-line-item__body">
      <div class="ln-line-item__title">Classic T-Shirt</div>
      <div class="ln-line-item__meta">Black / M · Qty 2</div>
    </div>
    <div class="ln-line-item__side">
      <div class="ln-line-item__price">$58.00</div>
      <button class="ln-line-item__remove" type="button" aria-label="Remove">&times;</button>
    </div>
  </div>
  <div class="ln-line-item">
    <div class="ln-line-item__media">
      <div class="docs-placeholder docs-placeholder--fill"></div>
    </div>
    <div class="ln-line-item__body">
      <div class="ln-line-item__title">Slim Fit Jeans</div>
      <div class="ln-line-item__meta">Indigo / 32</div>
    </div>
    <div class="ln-line-item__side">
      <div class="ln-line-item__price">$79.00</div>
      <button class="ln-line-item__remove" type="button" aria-label="Remove">&times;</button>
    </div>
  </div>
  <div class="ln-line-item">
    <div class="ln-line-item__media">
      <div class="docs-placeholder docs-placeholder--fill"></div>
    </div>
    <div class="ln-line-item__body">
      <div class="ln-line-item__title">Canvas Sneakers</div>
      <div class="ln-line-item__meta">White / 10</div>
    </div>
    <div class="ln-line-item__side">
      <div class="ln-line-item__price">$65.00</div>
      <button class="ln-line-item__remove" type="button" aria-label="Remove">&times;</button>
    </div>
  </div>
</div>
Classic T-Shirt
Black / M · Qty 2
$58.00
Slim Fit Jeans
Indigo / 32
$79.00
Canvas Sneakers
White / 10
$65.00

Order Summary

Checkout totals panel with line rows for subtotal, shipping, tax, and a bold total. Includes an actions area for the checkout button.

Default order summary

index.htmlhtml
<div class="ln-order-summary">
  <div class="ln-order-summary__header">Order Summary</div>
  <div class="ln-order-summary__row">
    <span>Subtotal</span>
    <span>$87.00</span>
  </div>
  <div class="ln-order-summary__row">
    <span>Shipping</span>
    <span>$5.99</span>
  </div>
  <div class="ln-order-summary__row">
    <span>Tax</span>
    <span>$7.44</span>
  </div>
  <div class="ln-order-summary__total">
    <span>Total</span>
    <span>$100.43</span>
  </div>
  <div class="ln-order-summary__actions">
    <button class="ln-button ln-button--solid ln-button--block ln-button--lg">Checkout</button>
  </div>
</div>
Order Summary
Subtotal$87.00
Shipping$5.99
Tax$7.44
Total$100.43

Reference

ClassDescriptionResponsive
.ln-priceFormatted price displayNo
.ln-price--saleSale price layout with original and discountNo
.ln-price--smSmall size variantNo
.ln-price--lgLarge size variantNo
.ln-ratingStar rating displayNo
.ln-rating--compactCompact rating layoutNo
.ln-swatchVariant selector groupNo
.ln-swatch--textText label swatchesNo
.ln-swatch--imageImage swatchesNo
.ln-quantityIncrement/decrement inputNo
.ln-quantity--compactCompact quantity controlNo
.ln-galleryImage gallery with scroll-snapNo
.ln-gallery--thumbs-startThumbnails on the left sideNo
.ln-gallery--gridGrid layout instead of carouselNo
.ln-product-cardCommerce card with media, body, and actionsNo
.ln-product-card--horizontalHorizontal card layoutNo
.ln-product-card--compactCompact cardNo
.ln-product-card--flatNo background or borderNo
.ln-line-itemCart or order rowNo
.ln-line-item--compactCompact line itemNo
.ln-line-item--readonlyRead-only line item (no remove button)No
.ln-order-summaryCheckout totals panelNo
.ln-order-summary--stickySticky positioningNo
.ln-order-summary--compactCompact spacingNo